Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.basedata.pdm.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
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.wms.basedata.pdm.service.SpendRowQtyService;
|
||||||
|
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 java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预排量维护前端控制器
|
||||||
|
* @author lxy
|
||||||
|
* @date 2023-12-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "预排量维护")
|
||||||
|
@RequestMapping("/api/spendRowQty")
|
||||||
|
@Slf4j
|
||||||
|
public class SpendRowQtyController {
|
||||||
|
|
||||||
|
private final SpendRowQtyService spendRowQtyService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询预排量")
|
||||||
|
@ApiOperation("查询预排量")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(spendRowQtyService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增预排量")
|
||||||
|
@ApiOperation("新增预排量")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject dto) {
|
||||||
|
spendRowQtyService.create(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改预排量")
|
||||||
|
@ApiOperation("修改预排量")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody JSONObject dto) {
|
||||||
|
spendRowQtyService.update(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除预排量")
|
||||||
|
@ApiOperation("删除预排量")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
spendRowQtyService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getMaterialList")
|
||||||
|
@Log("获取指定物料")
|
||||||
|
@ApiOperation("获取指定物料")
|
||||||
|
public ResponseEntity<Object> getMaterialList() {
|
||||||
|
return new ResponseEntity<>(spendRowQtyService.getMaterialList(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getSuppList")
|
||||||
|
@Log("获取供应商")
|
||||||
|
@ApiOperation("获取供应商")
|
||||||
|
public ResponseEntity<Object> getSuppList() {
|
||||||
|
return new ResponseEntity<>(spendRowQtyService.getSuppList(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.basedata.pdm.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务接口
|
||||||
|
* @author lxy
|
||||||
|
* @date 2023-12-12
|
||||||
|
*/
|
||||||
|
public interface SpendRowQtyService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param spend_id ID
|
||||||
|
* @return Customerbase
|
||||||
|
*/
|
||||||
|
JSONObject findById(Long spend_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void create(JSONObject dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void update(JSONObject dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定物料
|
||||||
|
* @return JSONArray /
|
||||||
|
*/
|
||||||
|
JSONArray getMaterialList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取供应商
|
||||||
|
* @return JSONArray /
|
||||||
|
*/
|
||||||
|
JSONArray getSuppList();
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.basedata.pdm.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
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.exception.BadRequestException;
|
||||||
|
import org.nl.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||||
|
import org.nl.wms.basedata.pdm.service.SpendRowQtyService;
|
||||||
|
import org.nl.wql.WQL;
|
||||||
|
import org.nl.wql.core.bean.ResultBean;
|
||||||
|
import org.nl.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wql.util.WqlUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2023-12-12
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class SpendRowQtyServiceImpl implements SpendRowQtyService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
|
||||||
|
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||||
|
String supp_code = MapUtil.getStr(whereJson, "supp_code");
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("flag", "1");
|
||||||
|
if (ObjectUtil.isNotEmpty(material_code)) {
|
||||||
|
param.put("material_code","%"+material_code+"%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(supp_code)) {
|
||||||
|
param.put("supp_code","%"+supp_code+"%");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = WQL.getWO("PDM_SPENDROWQTY").addParamMap(param).pageQuery(WqlUtil.getHttpContext(page), "spend.create_time DESC");
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject findById(Long spend_id) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("pdm_bi_spendrowqty");
|
||||||
|
JSONObject json = wo.query("spend_id =" + spend_id + "").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json)) return null;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(JSONObject json) {
|
||||||
|
WQLObject spendTab = WQLObject.getWQLObject("pdm_bi_spendrowqty");
|
||||||
|
// 校验此物料供应商是否存在相同的数据、
|
||||||
|
JSONObject jsonObject = spendTab.query("material_id = '" + json.getString("material_id") + "' and supp_id = '" + json.getString("supp_id") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||||
|
throw new BadRequestException("此物料、供应商的数据已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("spend_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
param.put("material_id", json.getString("material_id"));
|
||||||
|
param.put("supp_id", json.getString("supp_id"));
|
||||||
|
param.put("qty", json.getDoubleValue("qty"));
|
||||||
|
param.put("remark", json.getString("remark"));
|
||||||
|
param.put("create_id", currentUserId);
|
||||||
|
param.put("create_name", nickName);
|
||||||
|
param.put("create_time", now);
|
||||||
|
|
||||||
|
spendTab.insert(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(JSONObject json) {
|
||||||
|
WQLObject spendTab = WQLObject.getWQLObject("pdm_bi_spendrowqty");
|
||||||
|
|
||||||
|
JSONObject param = this.findById(json.getLongValue("spend_id"));
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
param.put("material_id", json.getString("material_id"));
|
||||||
|
param.put("supp_id", json.getString("supp_id"));
|
||||||
|
param.put("qty", json.getDoubleValue("qty"));
|
||||||
|
param.put("remark", json.getString("remark"));
|
||||||
|
param.put("update_id", currentUserId);
|
||||||
|
param.put("update_name", nickName);
|
||||||
|
param.put("update_time", now);
|
||||||
|
spendTab.update(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteAll(Long[] ids) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("pdm_bi_spendrowqty");
|
||||||
|
for (Long spend_id : ids) {
|
||||||
|
wo.delete("spend_id = '"+spend_id+"'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getMaterialList() {
|
||||||
|
return WQL.getWO("statistical_report_query_01").addParam("flag", "3").process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getSuppList() {
|
||||||
|
return WQL.getWO("PDM_SPENDROWQTY").addParam("flag", "2").process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 预排量维护分页查询
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.material_code TYPEAS s_string
|
||||||
|
输入.supp_code TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
spend.*,
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
supp.supp_code,
|
||||||
|
supp.supp_name
|
||||||
|
FROM
|
||||||
|
pdm_bi_spendrowqty spend
|
||||||
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = spend.material_id
|
||||||
|
LEFT JOIN md_cs_supplierbase supp ON supp.supp_id = spend.supp_id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
|
||||||
|
OPTION 输入.material_code <> ""
|
||||||
|
(mater.material_code like 输入.material_code or
|
||||||
|
mater.material_name like 输入.material_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.supp_code <> ""
|
||||||
|
(supp.supp_code like 输入.supp_code or
|
||||||
|
supp.supp_name like 输入.supp_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
md_cs_supplierbase
|
||||||
|
WHERE
|
||||||
|
is_delete = '0'
|
||||||
|
AND is_used = '1'
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
Binary file not shown.
@@ -231,22 +231,31 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
rows.add(jo1);
|
rows.add(jo1);
|
||||||
JSONObject jo22 = new JSONObject();
|
JSONObject jo22 = new JSONObject();
|
||||||
jo22.put("first", "已开单重量");
|
jo22.put("first", "已开单重量");
|
||||||
rows.add(jo22);
|
// rows.add(jo22);
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("first", "排产需求量");
|
jo2.put("first", "排产需求量");
|
||||||
rows.add(jo2);
|
rows.add(jo2);
|
||||||
JSONObject jo3 = new JSONObject();
|
JSONObject jo3 = new JSONObject();
|
||||||
jo3.put("first", "库/需差额量");
|
jo3.put("first", "库/需差额量");
|
||||||
rows.add(jo3);
|
rows.add(jo3);
|
||||||
JSONObject jo4 = new JSONObject();
|
|
||||||
jo4.put("first", "待检入库量");
|
|
||||||
rows.add(jo4);
|
|
||||||
JSONObject jo5 = new JSONObject();
|
JSONObject jo5 = new JSONObject();
|
||||||
jo5.put("first", "覆盖日期");
|
jo5.put("first", "覆盖日期");
|
||||||
rows.add(jo5);
|
rows.add(jo5);
|
||||||
|
JSONObject jo4 = new JSONObject();
|
||||||
|
jo4.put("first", "待检入库量");
|
||||||
|
rows.add(jo4);
|
||||||
|
JSONObject jo10 = new JSONObject();
|
||||||
|
jo10.put("first", "覆盖日期(含待检)");
|
||||||
|
rows.add(jo10);
|
||||||
|
JSONObject jo11 = new JSONObject();
|
||||||
|
jo11.put("first", "后续需求量");
|
||||||
|
rows.add(jo11);
|
||||||
JSONObject jo6 = new JSONObject();
|
JSONObject jo6 = new JSONObject();
|
||||||
jo6.put("first", "合同在途");
|
jo6.put("first", "合同在途");
|
||||||
rows.add(jo6);
|
rows.add(jo6);
|
||||||
|
JSONObject jo12 = new JSONObject();
|
||||||
|
jo12.put("first", "预排量");
|
||||||
|
rows.add(jo12);
|
||||||
JSONObject jo7 = new JSONObject();
|
JSONObject jo7 = new JSONObject();
|
||||||
jo7.put("first", "最低储备定额");
|
jo7.put("first", "最低储备定额");
|
||||||
rows.add(jo7);
|
rows.add(jo7);
|
||||||
@@ -288,6 +297,34 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
JSONArray noinJoArray = WQL.getWO("statistical_report_query_01").addParam("flag", "77").process().getResultJSONArray(0);
|
JSONArray noinJoArray = WQL.getWO("statistical_report_query_01").addParam("flag", "77").process().getResultJSONArray(0);
|
||||||
Map<String, List<Object>> noinJoMap = noinJoArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
Map<String, List<Object>> noinJoMap = noinJoArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
||||||
|
|
||||||
|
// 待检入库量+库存物料数量
|
||||||
|
JSONArray ivtNoinArry = new JSONArray();
|
||||||
|
|
||||||
|
List<JSONObject> collectNoin = noinJoArray.stream()
|
||||||
|
.map(row -> JSON.parseObject(JSON.toJSONString(row)))
|
||||||
|
.map(row -> {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("qty", row.getDoubleValue("noin_qty"));
|
||||||
|
json.put("material_id", row.getString("material_id"));
|
||||||
|
return json;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
ivtNoinArry.addAll(materQryArray);
|
||||||
|
ivtNoinArry.addAll(collectNoin);
|
||||||
|
|
||||||
|
Map<String, List<JSONObject>> noSumMap = ivtNoinArry.stream()
|
||||||
|
.map(row -> JSON.parseObject(JSON.toJSONString(row)))
|
||||||
|
.collect(Collectors.groupingBy(row -> row.getString("material_id")));
|
||||||
|
|
||||||
|
Map<String, Double> ivtNoinMap = noSumMap.entrySet().stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
Map.Entry::getKey,
|
||||||
|
row -> row.getValue().stream()
|
||||||
|
.map(item -> item.getDoubleValue("qty"))
|
||||||
|
.reduce(Double::sum).orElse(0.00)
|
||||||
|
));
|
||||||
|
|
||||||
//查询物料计划日期内的需求量
|
//查询物料计划日期内的需求量
|
||||||
JSONArray DataPlanQtyArray = WQL.getWO("statistical_report_query_01").addParam("flag", "10")
|
JSONArray DataPlanQtyArray = WQL.getWO("statistical_report_query_01").addParam("flag", "10")
|
||||||
.addParam("begin_time", begin_time)
|
.addParam("begin_time", begin_time)
|
||||||
@@ -297,6 +334,10 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
Map<String, List<Object>> datePlanMap = DataPlanQtyArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
Map<String, List<Object>> datePlanMap = DataPlanQtyArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
||||||
|
|
||||||
|
// 汇总所有预排量
|
||||||
|
List<JSONObject> spendList = WQL.getWO("statistical_report_query_01").addParam("flag", "12")
|
||||||
|
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||||
|
|
||||||
for (int i = 0; i < mater_rows.size(); i++) {
|
for (int i = 0; i < mater_rows.size(); i++) {
|
||||||
JSONObject mater = mater_rows.getJSONObject(i);
|
JSONObject mater = mater_rows.getJSONObject(i);
|
||||||
String material_id = mater.getString("material_id");
|
String material_id = mater.getString("material_id");
|
||||||
@@ -316,7 +357,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
|
|
||||||
double canuse_num = now_ivt;
|
double canuse_num = now_ivt;
|
||||||
//已开单重量
|
//已开单重量
|
||||||
jo22.put(material_id, String.format("%.2f", need_qty));
|
// jo22.put(material_id, String.format("%.2f", need_qty));
|
||||||
//2、排产需求量(未开工的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量:
|
//2、排产需求量(未开工的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量:
|
||||||
double bom_qty = 0;
|
double bom_qty = 0;
|
||||||
List<Object> needMaterInfo = needMaterMap.get(material_id);
|
List<Object> needMaterInfo = needMaterMap.get(material_id);
|
||||||
@@ -347,19 +388,16 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("flag", "4");
|
map.put("flag", "4");
|
||||||
map.put("ext_id", jsonMater.getString("ext_id"));
|
map.put("ext_id", jsonMater.getString("ext_id"));
|
||||||
//JSONObject num_jo = null;
|
// JSONObject num_jo = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").process().uniqueResult(0);
|
||||||
JSONObject num_jo = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").process().uniqueResult(0);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//合同在途
|
//合同在途
|
||||||
double notqty = 0;
|
double notqty = 0;
|
||||||
if (ObjectUtil.isNotEmpty(num_jo)) {
|
/*if (ObjectUtil.isNotEmpty(num_jo)) {
|
||||||
notqty = num_jo.getDoubleValue("notqty");
|
notqty = num_jo.getDoubleValue("notqty");
|
||||||
if (notqty < 0) {
|
if (notqty < 0) {
|
||||||
notqty = 0;
|
notqty = 0;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
jo6.put(material_id, String.format("%.2f", notqty));
|
jo6.put(material_id, String.format("%.2f", notqty));
|
||||||
|
|
||||||
//5、库/需差额量 :库存现存量-排产需求量
|
//5、库/需差额量 :库存现存量-排产需求量
|
||||||
@@ -406,6 +444,49 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 覆盖日期(含待检)
|
||||||
|
double ivtNoinSum = ObjectUtil.isEmpty(ivtNoinMap.get(material_id)) ? 0 : ivtNoinMap.get(material_id);
|
||||||
|
if (ivtNoinSum < 0 ) {
|
||||||
|
jo10.put(material_id, DateUtil.offsetDay(date1, -1).toString().substring(0, 10));
|
||||||
|
} else {
|
||||||
|
List<Object> materDataPlanQty = datePlanMap.get(material_id);
|
||||||
|
double needWeight;
|
||||||
|
jo10.put(material_id, end_time.substring(0, 10));
|
||||||
|
if (ObjectUtil.isNotEmpty(materDataPlanQty)){
|
||||||
|
for (Object todayQty : materDataPlanQty) {
|
||||||
|
JSONObject jsonQty = (JSONObject) todayQty;
|
||||||
|
needWeight = jsonQty.getDoubleValue("qty");
|
||||||
|
Date currentDate = ((JSONObject) todayQty).getDate("currentdate");
|
||||||
|
if (ivtNoinSum < needWeight) {
|
||||||
|
jo10.put(material_id, DateUtil.offsetDay(currentDate, -1).toString().substring(0, 10));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
ivtNoinSum -= needWeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后续需求(覆盖日期(含待检)之后10天的排产需求量之和)
|
||||||
|
String endDate = DateUtil.offsetDay(jo10.getDate(material_id), 10).toString().substring(0, 10);
|
||||||
|
|
||||||
|
JSONObject backNeed = WQL.getWO("statistical_report_query_01").addParam("flag", "6")
|
||||||
|
.addParam("begin_date", jo10.getString(material_id))
|
||||||
|
.addParam("end_date", endDate)
|
||||||
|
.addParam("org_ids", org_ids_new)
|
||||||
|
.addParam("material_id", material_id)
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
|
||||||
|
jo11.put(material_id, ObjectUtil.isEmpty(backNeed) ? "0.00" : String.format("%.2f",backNeed.getDoubleValue("qty")));
|
||||||
|
|
||||||
|
// 预排量
|
||||||
|
List<JSONObject> spendList2 = spendList.stream()
|
||||||
|
.filter(row -> row.getString("material_id").equals(material_id))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
jo12.put(material_id, ObjectUtil.isNotEmpty(spendList2) ? String.format("%.2f", spendList2.get(0).getDoubleValue("qty")) : "0.00");
|
||||||
|
|
||||||
}
|
}
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("content", rows);
|
jo.put("content", rows);
|
||||||
@@ -455,6 +536,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
throw new BadRequestException("未查询到该产品 " + material_code + " 对应BOM信息");
|
throw new BadRequestException("未查询到该产品 " + material_code + " 对应BOM信息");
|
||||||
}
|
}
|
||||||
row.put("1", row.getString("planstart_date"));
|
row.put("1", row.getString("planstart_date"));
|
||||||
|
row.put("4", row.getString("name"));
|
||||||
row.put("2", row.getString("old_mark"));
|
row.put("2", row.getString("old_mark"));
|
||||||
row.put("3", row.getString("product_num"));
|
row.put("3", row.getString("product_num"));
|
||||||
//查询该物料对应的bom明细
|
//查询该物料对应的bom明细
|
||||||
@@ -498,6 +580,10 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
jsonResuft1.put("prop", "1");
|
jsonResuft1.put("prop", "1");
|
||||||
jsonResuft1.put("label", "日期");
|
jsonResuft1.put("label", "日期");
|
||||||
jsonResuft1.put("option", true);
|
jsonResuft1.put("option", true);
|
||||||
|
JSONObject jsonResuft5 = new JSONObject();
|
||||||
|
jsonResuft5.put("prop", "4");
|
||||||
|
jsonResuft5.put("label", "所属组织");
|
||||||
|
jsonResuft5.put("option", true);
|
||||||
JSONObject jsonResuft2 = new JSONObject();
|
JSONObject jsonResuft2 = new JSONObject();
|
||||||
jsonResuft2.put("prop", "2");
|
jsonResuft2.put("prop", "2");
|
||||||
jsonResuft2.put("label", "牌号");
|
jsonResuft2.put("label", "牌号");
|
||||||
@@ -507,6 +593,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
|||||||
jsonResuft3.put("label", "批数");
|
jsonResuft3.put("label", "批数");
|
||||||
jsonResuft3.put("option", true);
|
jsonResuft3.put("option", true);
|
||||||
jonsResuftArr.add(jsonResuft1);
|
jonsResuftArr.add(jsonResuft1);
|
||||||
|
jonsResuftArr.add(jsonResuft5);
|
||||||
jonsResuftArr.add(jsonResuft2);
|
jonsResuftArr.add(jsonResuft2);
|
||||||
jonsResuftArr.add(jsonResuft3);
|
jonsResuftArr.add(jsonResuft3);
|
||||||
for (int i = 0; i < jsonArr.size(); i++) {
|
for (int i = 0; i < jsonArr.size(); i++) {
|
||||||
|
|||||||
@@ -638,7 +638,8 @@
|
|||||||
ext.old_mark,
|
ext.old_mark,
|
||||||
plan.product_weight,
|
plan.product_weight,
|
||||||
plan.material_id,
|
plan.material_id,
|
||||||
materialbase.material_code
|
materialbase.material_code,
|
||||||
|
dept.name
|
||||||
FROM
|
FROM
|
||||||
mps_bd_productdailyplan plan
|
mps_bd_productdailyplan plan
|
||||||
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = plan.material_id
|
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = plan.material_id
|
||||||
@@ -663,11 +664,13 @@
|
|||||||
MAX(ext.old_mark) AS old_mark,
|
MAX(ext.old_mark) AS old_mark,
|
||||||
SUM(wo.workorder_qty) AS product_weight,
|
SUM(wo.workorder_qty) AS product_weight,
|
||||||
wo.material_id,
|
wo.material_id,
|
||||||
MAX(mb.material_code) AS material_code
|
MAX(mb.material_code) AS material_code,
|
||||||
|
MAX(dept.name) AS name
|
||||||
FROM
|
FROM
|
||||||
pdm_bi_workorder wo
|
pdm_bi_workorder wo
|
||||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = wo.material_id
|
LEFT JOIN md_me_materialbase mb ON mb.material_id = wo.material_id
|
||||||
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = wo.material_id
|
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = wo.material_id
|
||||||
|
LEFT JOIN sys_dept dept ON dept.dept_id = wo.org_id
|
||||||
WHERE
|
WHERE
|
||||||
wo.`status` < 50
|
wo.`status` < 50
|
||||||
AND
|
AND
|
||||||
@@ -787,5 +790,19 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "12"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
material_id,
|
||||||
|
SUM(qty) AS qty
|
||||||
|
FROM
|
||||||
|
pdm_bi_spendrowqty
|
||||||
|
|
||||||
|
group by material_id
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
dtl.pcsn,
|
dtl.pcsn,
|
||||||
dtl.receive_code,
|
dtl.receive_code,
|
||||||
dtl.material_id,
|
dtl.material_id,
|
||||||
mst.source_name
|
mst.source_name,
|
||||||
|
mst.receive_date
|
||||||
FROM
|
FROM
|
||||||
PCS_RC_ReceiveDtl dtl
|
PCS_RC_ReceiveDtl dtl
|
||||||
inner JOIN pcs_rc_receivemst mst ON mst.receive_id = dtl.receive_id
|
inner JOIN pcs_rc_receivemst mst ON mst.receive_id = dtl.receive_id
|
||||||
|
|||||||
41
mes/qd/src/api/wms/basedata/pdm/spendrowqty.js
Normal file
41
mes/qd/src/api/wms/basedata/pdm/spendrowqty.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/spendRowQty',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/spendRowQty/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/spendRowQty',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getMaterialList() {
|
||||||
|
return request({
|
||||||
|
url: 'api/spendRowQty/getMaterialList',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSuppList() {
|
||||||
|
return request({
|
||||||
|
url: 'api/spendRowQty/getSuppList',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, getMaterialList, getSuppList }
|
||||||
219
mes/qd/src/views/wms/basedata/pdm/spendrowqty/index.vue
Normal file
219
mes/qd/src/views/wms/basedata/pdm/spendrowqty/index.vue
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="物料编码">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_code"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="物料编码、名称"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="供应商">
|
||||||
|
<el-input
|
||||||
|
v-model="query.supp_code"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="供应商编码、名称"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="1100px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="物料选择" prop="cust_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.material_id"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="可搜索"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 180px"
|
||||||
|
:disabled="crud.status.edit > 0"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in materialList"
|
||||||
|
:key="item.material_id"
|
||||||
|
:label="item.material_name"
|
||||||
|
:value="item.material_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="供应商 " prop="cust_name">
|
||||||
|
<el-select
|
||||||
|
v-model="form.supp_id"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="可搜索"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 180px"
|
||||||
|
:disabled="crud.status.edit > 0"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in suppList"
|
||||||
|
:key="item.supp_id"
|
||||||
|
:label="item.supp_name"
|
||||||
|
:value="item.supp_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.qty"
|
||||||
|
:controls="false"
|
||||||
|
:precision="3"
|
||||||
|
:min="0"
|
||||||
|
style="width: 180px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column prop="material_code" label="物料编码" />
|
||||||
|
<el-table-column prop="material_name" label="物料名称" />
|
||||||
|
<el-table-column prop="supp_name" label="供应商名称" width="250px" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="qty" label="数量" :formatter="crud.formatNum3" />
|
||||||
|
<el-table-column prop="create_name" label="创建者" />
|
||||||
|
<el-table-column prop="create_time" label="创建时间" width="150" />
|
||||||
|
<el-table-column prop="update_name" label="修改者" />
|
||||||
|
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','customerbase:edit','customerbase:del']"
|
||||||
|
label="操作"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudSpendrowqtyfrom from '@/api/wms/basedata/pdm/spendrowqty'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
spend_id: null,
|
||||||
|
material_id: null,
|
||||||
|
supp_id: null,
|
||||||
|
qty: null,
|
||||||
|
remark: null,
|
||||||
|
create_id: null,
|
||||||
|
create_name: null,
|
||||||
|
create_time: null,
|
||||||
|
update_id: null,
|
||||||
|
update_name: null,
|
||||||
|
update_time: null
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'Spendrowqty',
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '预排量维护',
|
||||||
|
url: 'api/spendRowQty',
|
||||||
|
optShow: {
|
||||||
|
add: true,
|
||||||
|
reset: true
|
||||||
|
},
|
||||||
|
idField: 'spend_id',
|
||||||
|
sort: 'spend_id,desc',
|
||||||
|
crudMethod: { ...crudSpendrowqtyfrom }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
permission: {},
|
||||||
|
materialList: [],
|
||||||
|
suppList: [],
|
||||||
|
rules: {
|
||||||
|
material_id: [
|
||||||
|
{ required: true, message: '物料不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
supp_id: [
|
||||||
|
{ required: true, message: '供应商不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
qty: [
|
||||||
|
{ required: true, message: '数量不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudSpendrowqtyfrom.getMaterialList().then(res => {
|
||||||
|
this.materialList = res
|
||||||
|
})
|
||||||
|
crudSpendrowqtyfrom.getSuppList().then(res => {
|
||||||
|
this.suppList = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -76,6 +76,7 @@
|
|||||||
<el-table-column prop="receive_qty" label="订单重量" min-width="100" :formatter="crud.formatNum2" />
|
<el-table-column prop="receive_qty" label="订单重量" min-width="100" :formatter="crud.formatNum2" />
|
||||||
<el-table-column prop="noin_qty" label="剩余重量" min-width="100" :formatter="crud.formatNum2" />
|
<el-table-column prop="noin_qty" label="剩余重量" min-width="100" :formatter="crud.formatNum2" />
|
||||||
<el-table-column prop="source_name" label="供应商" min-width="100" />
|
<el-table-column prop="source_name" label="供应商" min-width="100" />
|
||||||
|
<el-table-column prop="receive_date" label="到货时间" min-width="100" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<el-table-column type="index" label="序号" width="100" align="center" fixed />
|
<el-table-column type="index" label="序号" width="100" align="center" fixed />
|
||||||
<template v-for="(col,index) in cols">
|
<template v-for="(col,index) in cols">
|
||||||
<el-table-column v-if="col.prop !== 'first'" :prop="col.prop" :label="col.label" width="120px" />
|
<el-table-column v-if="col.prop !== 'first'" :prop="col.prop" :label="col.label" width="120px" />
|
||||||
<el-table-column v-if="col.prop === 'first'" :prop="col.prop" :label="col.label" width="120px" fixed>
|
<el-table-column v-if="col.prop === 'first'" :prop="col.prop" :label="col.label" width="140px" fixed>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-show="!isshow(scope.row)">{{ scope.row.first }}</span>
|
<span v-show="!isshow(scope.row)">{{ scope.row.first }}</span>
|
||||||
<el-link v-show="isshow(scope.row)" type="warning" @click="open2(scope.$index, scope.row)">{{ scope.row.first }}</el-link>
|
<el-link v-show="isshow(scope.row)" type="warning" @click="open2(scope.$index, scope.row)">{{ scope.row.first }}</el-link>
|
||||||
|
|||||||
Reference in New Issue
Block a user