优化
This commit is contained in:
@@ -44,6 +44,14 @@ public class PerformancemstController {
|
||||
return new ResponseEntity<>(performancemstService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/query2")
|
||||
@Log("查询工作量汇报")
|
||||
@ApiOperation("查询工作量汇报")
|
||||
//@PreAuthorize("@el.check('performancemst:list')")
|
||||
public ResponseEntity<Object> query2(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(performancemstService.queryAll2(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/workloadstat")
|
||||
@Log("工作量统计数据")
|
||||
@ApiOperation("工作量统计数据")
|
||||
|
||||
@@ -24,6 +24,13 @@ public interface PerformancemstService {
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll2(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
|
||||
@@ -61,6 +61,20 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll2(Map whereJson, Pageable page) {
|
||||
String assessor_id = (String) whereJson.get("assessor_id");
|
||||
String assessor_date = (String) whereJson.get("assessor_date");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
if (ObjectUtil.isNotEmpty(assessor_id)) {
|
||||
map.put("assessor_id", "%" + assessor_id + "%");
|
||||
}
|
||||
map.put("assessor_date", assessor_date);
|
||||
JSONObject json = WQL.getWO("QL_TEST_PERFORMANCEMST01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.update_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PerformancemstDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("ql_test_performancemst");
|
||||
@@ -126,6 +140,7 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
jsonDtl.put("item_name", json.getString("item_name"));
|
||||
if (ObjectUtil.isEmpty(json.getString("workload"))) throw new BadRequestException("工作量不能为空!");
|
||||
jsonDtl.put("workload", json.getString("workload"));
|
||||
jsonDtl.put("workload_audit", json.getString("workload_audit"));
|
||||
//算出每行的分数
|
||||
BigDecimal num = NumberUtil.mul(json.getString("single_score"), json.getString("workload"));
|
||||
jsonDtl.put("score", NumberUtil.round(num, 2));
|
||||
@@ -171,6 +186,7 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
jsonDtl.put("item_name", json.getString("item_name"));
|
||||
if (ObjectUtil.isEmpty(json.getString("workload"))) throw new BadRequestException("工作量不能为空!");
|
||||
jsonDtl.put("workload", json.getString("workload"));
|
||||
jsonDtl.put("workload_audit", json.getString("workload_audit"));
|
||||
//算出每行的分数
|
||||
BigDecimal num = NumberUtil.mul(json.getString("single_score"), json.getString("workload"));
|
||||
jsonDtl.put("score", NumberUtil.round(num, 2));
|
||||
@@ -186,6 +202,7 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("ql_test_performancemst");
|
||||
WQLObject ql_test_performancedtl = WQLObject.getWQLObject("ql_test_performancedtl");
|
||||
for (Long performance_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("performance_id", String.valueOf(performance_id));
|
||||
@@ -194,6 +211,7 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
ql_test_performancedtl.delete("performance_id='"+String.valueOf(performance_id)+"'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
IF 输入.flag = "9"
|
||||
QUERY
|
||||
SELECT
|
||||
sum (IFNULL(dtl.workload,0)) AS num,
|
||||
sum (IFNULL(dtl.workload_audit,0)) AS num,
|
||||
mst.assessor_id
|
||||
FROM
|
||||
QL_TEST_PerformanceMst mst
|
||||
|
||||
Binary file not shown.
@@ -493,6 +493,28 @@ public class ReceivemstServiceImpl implements ReceivemstService {
|
||||
}
|
||||
JSONObject jsonFactMst = factMstTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonMst)) {
|
||||
//插入质检单
|
||||
HashMap<Object, Object> param = new HashMap<>();
|
||||
param.put("material_id", String.valueOf(material_id));
|
||||
boolean is_YL = materialBaseService.isAlongMaterType(MaterOptTypeEnum.YL.getCode(), material_id, null);
|
||||
boolean is_FL = materialBaseService.isAlongMaterType(MaterOptTypeEnum.FL.getCode(), material_id, null);
|
||||
boolean is_BCP = materialBaseService.isAlongMaterType(MaterOptTypeEnum.BCP.getCode(), material_id, null);
|
||||
if (is_YL) param.put("inspection_type", "10");
|
||||
if (is_FL) param.put("inspection_type", "20");
|
||||
if (is_BCP) param.put("inspection_type", "30");
|
||||
param.put("pcsn", MapUtil.getStr(whereJson, "pcsn"));
|
||||
param.put("source_bill_id", MapUtil.getStr(whereJson, "receivedtl_id"));
|
||||
param.put("source_bill_code", MapUtil.getStr(whereJson, "receive_code"));
|
||||
param.put("source_bill_type", MapUtil.getStr(whereJson, "receive_type"));
|
||||
param.put("source_bill_table", "PCS_RC_ReceiveDtl");
|
||||
param.put("source_bill_table_pk", "");
|
||||
param.put("base_bill_id", jsonReMst.get("source_id"));
|
||||
param.put("base_bill_type", jsonReMst.get("source_type"));
|
||||
inspectionsheetmstService.create(param);
|
||||
}else{
|
||||
throw new BadRequestException("质检单已存在,不允许重复插入!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonFactMst)) {
|
||||
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
JSONObject jsonUnit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
@@ -527,29 +549,6 @@ public class ReceivemstServiceImpl implements ReceivemstService {
|
||||
}else{
|
||||
throw new BadRequestException("厂家质保书已存在,不允许重复插入!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(jsonMst)) {
|
||||
//插入质检单
|
||||
HashMap<Object, Object> param = new HashMap<>();
|
||||
param.put("material_id", String.valueOf(material_id));
|
||||
boolean is_YL = materialBaseService.isAlongMaterType(MaterOptTypeEnum.YL.getCode(), material_id, null);
|
||||
boolean is_FL = materialBaseService.isAlongMaterType(MaterOptTypeEnum.FL.getCode(), material_id, null);
|
||||
boolean is_BCP = materialBaseService.isAlongMaterType(MaterOptTypeEnum.BCP.getCode(), material_id, null);
|
||||
if (is_YL) param.put("inspection_type", "10");
|
||||
if (is_FL) param.put("inspection_type", "20");
|
||||
if (is_BCP) param.put("inspection_type", "30");
|
||||
param.put("pcsn", MapUtil.getStr(whereJson, "pcsn"));
|
||||
param.put("source_bill_id", MapUtil.getStr(whereJson, "receivedtl_id"));
|
||||
param.put("source_bill_code", MapUtil.getStr(whereJson, "receive_code"));
|
||||
param.put("source_bill_type", MapUtil.getStr(whereJson, "receive_type"));
|
||||
param.put("source_bill_table", "PCS_RC_ReceiveDtl");
|
||||
param.put("source_bill_table_pk", "");
|
||||
param.put("base_bill_id", jsonReMst.get("source_id"));
|
||||
param.put("base_bill_type", jsonReMst.get("source_type"));
|
||||
inspectionsheetmstService.create(param);
|
||||
}else{
|
||||
throw new BadRequestException("质检单已存在,不允许重复插入!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -103,3 +103,19 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
sum(QTY_ZT) AS notqty
|
||||
FROM
|
||||
PURCHASE_CONTRACT_VIEW
|
||||
where
|
||||
STATUSFLAG = '3'
|
||||
AND DEL_FLAG = '0'
|
||||
OPTION 输入.ext_id <> ""
|
||||
ITEM_ID = 输入.ext_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -92,6 +92,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> materPlanQuery(Map whereJson) {
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料信息表
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
String org_id = MapUtil.getStr(whereJson, "org_id");
|
||||
@@ -150,44 +151,55 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
need_qty = dtlJa_map.get(material_id);
|
||||
}
|
||||
|
||||
jo1.put(material_id, String.format("%.3f", now_ivt));
|
||||
jo1.put(material_id, String.format("%.2f", now_ivt));
|
||||
|
||||
double canuse_num = now_ivt;
|
||||
//已开单重量
|
||||
jo22.put(material_id, String.format("%.3f", need_qty));
|
||||
jo22.put(material_id, String.format("%.2f", need_qty));
|
||||
//2、排产需求量(未开工的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量:
|
||||
JSONObject nedd_mater = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("material_id", material_id).addParam("begin_time", begin_time).addParam("end_time", end_time).addParam("org_id", org_id).process().uniqueResult(0);
|
||||
double bom_qty = 0;
|
||||
if (ObjectUtil.isNotEmpty(nedd_mater)) {
|
||||
bom_qty = nedd_mater.getDoubleValue("qty");
|
||||
}
|
||||
jo2.put(material_id, String.format("%.3f", bom_qty));
|
||||
|
||||
//3、待检入库量:sum(此物料未确认的到货单的单据数-入库数)
|
||||
JSONObject num_jo = WQL.getWO("statistical_report_query_01").addParam("flag", "7").addParam("material_id", material_id).process().uniqueResult(0);
|
||||
jo2.put(material_id, String.format("%.2f", bom_qty));
|
||||
|
||||
//3、待检入库量:sum(此物料未确认的到货单的单据数-入库数)
|
||||
JSONObject noin_jo = WQL.getWO("statistical_report_query_01").addParam("flag", "77").addParam("material_id", material_id).process().uniqueResult(0);
|
||||
//合同在途
|
||||
double notqty = 0;
|
||||
//待检+未入库数量
|
||||
double noin_qty = 0;
|
||||
if (ObjectUtil.isNotEmpty(noin_jo)) {
|
||||
noin_qty = noin_jo.getDoubleValue("noin_qty");
|
||||
}
|
||||
jo4.put(material_id, String.format("%.2f", noin_qty));
|
||||
|
||||
|
||||
// 合同在途1.将wms物料id转换成本erp物料id
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||
throw new BadRequestException("此物料" + material_id + "在mes系统不存在");
|
||||
}
|
||||
if (StrUtil.isEmpty(jsonMater.getString("ext_id"))) {
|
||||
throw new BadRequestException("此物料" + material_id + "在mes系统不存在erp物料外键");
|
||||
}
|
||||
// 2.根据物料、批次查询erp系统中是否存在此批次的理化报告
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "4");
|
||||
map.put("ext_id", jsonMater.getString("ext_id"));
|
||||
JSONObject num_jo = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").process().uniqueResult(0);
|
||||
|
||||
//合同在途
|
||||
double notqty = 0;
|
||||
if (ObjectUtil.isNotEmpty(num_jo)) {
|
||||
notqty = num_jo.getDoubleValue("notqty");
|
||||
if (notqty < 0) {
|
||||
notqty = 0;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(noin_jo)) {
|
||||
noin_qty = noin_jo.getDoubleValue("noin_qty");
|
||||
}
|
||||
jo4.put(material_id, String.format("%.3f", noin_qty));
|
||||
|
||||
//4、合同在途:订单量-到货量
|
||||
jo6.put(material_id, String.format("%.3f", notqty));
|
||||
jo6.put(material_id, String.format("%.2f", notqty));
|
||||
|
||||
//5、库/需差额量 :库存现存量-排产需求量
|
||||
jo3.put(material_id, String.format("%.3f", (canuse_num - bom_qty)));
|
||||
jo3.put(material_id, String.format("%.2f", (canuse_num - bom_qty)));
|
||||
|
||||
//7、最低储备定额:物料的安全库存量下限
|
||||
JSONObject safe_jo = WQLObject.getWQLObject("ST_IVT_MaterialSafeIvt").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
@@ -195,11 +207,11 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
if (ObjectUtil.isNotEmpty(safe_jo)) {
|
||||
safe_qty = safe_jo.getDoubleValue("safe_ivt_down");
|
||||
}
|
||||
jo7.put(material_id, String.format("%.3f", safe_qty));
|
||||
jo7.put(material_id, String.format("%.2f", safe_qty));
|
||||
|
||||
//8、采购缺口:库存+待检+在途+最低储备-排产量
|
||||
double buy_qty = (canuse_num + noin_qty + notqty) - (bom_qty + safe_qty);
|
||||
jo8.put(material_id, String.format("%.3f", buy_qty));
|
||||
jo8.put(material_id, String.format("%.2f", buy_qty));
|
||||
|
||||
//6、覆盖日期:物料库存可坚持到哪一天:库存现存量减每天需求量,哪天<0,取前一天
|
||||
if (canuse_num<0){
|
||||
@@ -254,7 +266,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
JSONObject dtl = bom_dtl.getJSONObject(j);
|
||||
double standard_rate = dtl.getDoubleValue("standard_rate");
|
||||
double qty = standard_rate * row.getDoubleValue("product_weight") * 0.01;
|
||||
row.put(dtl.getString("material_id"), String.format("%.3f", qty));
|
||||
row.put(dtl.getString("material_id"), String.format("%.2f", qty));
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user