Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -119,3 +119,22 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
ITEM_ID AS ext_id,
|
||||
sum(QTY_ZT) AS notqty
|
||||
FROM
|
||||
PURCHASE_CONTRACT_VIEW
|
||||
where
|
||||
STATUSFLAG = '3'
|
||||
AND DEL_FLAG = '0'
|
||||
OPTION 输入.ext_id <> ""
|
||||
ITEM_ID in 输入.ext_id
|
||||
ENDOPTION
|
||||
GROUP BY ITEM_ID
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ public class DeviceBigScreenController {
|
||||
@PostMapping("/updateWarnTime")
|
||||
@Log("当日任务列表")
|
||||
@ApiOperation("当日任务列表")
|
||||
public void getTodayTask(@RequestBody JSONObject json){
|
||||
deviceBigScreenService.updateWarnTime(json);
|
||||
public ResponseEntity<Object> getTodayTask(@RequestBody JSONObject json){
|
||||
JSONObject jsonObject = deviceBigScreenService.updateWarnTime(json);
|
||||
return new ResponseEntity<>(jsonObject,HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,5 +55,5 @@ public interface DeviceBigScreenService {
|
||||
/**
|
||||
* 更新播报时间
|
||||
*/
|
||||
void updateWarnTime(JSONObject json);
|
||||
JSONObject updateWarnTime(JSONObject json);
|
||||
}
|
||||
|
||||
@@ -546,7 +546,8 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarnTime(JSONObject json) {
|
||||
public JSONObject updateWarnTime(JSONObject json) {
|
||||
JSONObject result = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
try {
|
||||
JSONArray ids = json.getJSONArray("ids");
|
||||
@@ -555,9 +556,14 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
param.put("WARN_TIME", DateUtil.now());
|
||||
WQLObject deviceRepairRequest = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");
|
||||
deviceRepairRequest.update(param,"request_id in (\'"+requestId+"\')");
|
||||
result.put("code", "1");
|
||||
result.put("desc", "更新成功");
|
||||
}catch (Exception ex){
|
||||
result.put("code", "0");
|
||||
result.put("desc", "更新失败");
|
||||
log.error("updateWarnTime error:{}",ex.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ 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.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -98,7 +100,6 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
String org_id = MapUtil.getStr(whereJson, "org_id");
|
||||
Date date1 = DateUtil.parse(begin_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long betweenDay = DateUtil.between(date1, date2, DateUnit.DAY);
|
||||
JSONArray rows = new JSONArray();
|
||||
JSONArray mater_rows = WQL.getWO("statistical_report_query_01").addParam("flag", "3").process().getResultJSONArray(0);
|
||||
JSONObject jo1 = new JSONObject();
|
||||
@@ -136,16 +137,33 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
JSONObject form_qty = dtlJa.getJSONObject(i);
|
||||
dtlJa_map.put(form_qty.getString("material_id"),form_qty.getDouble("qty"));
|
||||
}
|
||||
//库存物料数量
|
||||
JSONArray materQryArray = WQL.getWO("statistical_report_query_01").addParam("flag", "4").process().getResultJSONArray(0);
|
||||
Map<String, List<Object>> materialMap = materQryArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
||||
//排产需求
|
||||
JSONArray needMaterArray = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("begin_time", begin_time).addParam("end_time", end_time).addParam("org_id", org_id).process().getResultJSONArray(0);
|
||||
Map<String, List<Object>> needMaterMap = needMaterArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
||||
|
||||
//3、待检入库量:sum(此物料未确认的到货单的单据数-入库数)
|
||||
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")));
|
||||
|
||||
//查询物料计划日期内的需求量
|
||||
JSONArray DataPlanQtyArray = WQL.getWO("statistical_report_query_01").addParam("flag", "10")
|
||||
.addParam("begin_time", begin_time.substring(0, 10) + "%")
|
||||
.addParam("end_time", end_time.substring(0, 10) + "%").process().getResultJSONArray(0);
|
||||
Map<String, List<Object>> datePlanMap = DataPlanQtyArray.stream().collect(Collectors.groupingBy(a -> ((JSONObject)a).getString("material_id")));
|
||||
|
||||
for (int i = 0; i < mater_rows.size(); i++) {
|
||||
JSONObject mater = mater_rows.getJSONObject(i);
|
||||
String material_id = mater.getString("material_id");
|
||||
//1、库存现存量:现有库存
|
||||
JSONObject mater_ivt = WQL.getWO("statistical_report_query_01").addParam("flag", "4").addParam("material_id", material_id).process().uniqueResult(0);
|
||||
|
||||
double now_ivt = 0;
|
||||
double need_qty = 0;
|
||||
if (ObjectUtil.isNotEmpty(mater_ivt)) {
|
||||
now_ivt = mater_ivt.getDoubleValue("qty");
|
||||
List<Object> materInfo = materialMap.get(material_id);
|
||||
if (ObjectUtil.isNotEmpty(materInfo)) {
|
||||
now_ivt = ((JSONObject) materInfo.get(0)).getDoubleValue("qty");
|
||||
}
|
||||
if (dtlJa_map.containsKey(material_id)) {
|
||||
need_qty = dtlJa_map.get(material_id);
|
||||
@@ -157,19 +175,20 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
//已开单重量
|
||||
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);
|
||||
// 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");
|
||||
List<Object> needMaterInfo = needMaterMap.get(material_id);
|
||||
if (ObjectUtil.isNotEmpty(needMaterInfo)) {
|
||||
bom_qty = ((JSONObject) needMaterInfo.get(0)).getDoubleValue("qty");
|
||||
}
|
||||
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 noin_qty = 0;
|
||||
if (ObjectUtil.isNotEmpty(noin_jo)) {
|
||||
noin_qty = noin_jo.getDoubleValue("noin_qty");
|
||||
List<Object> noinJoInfo = noinJoMap.get(material_id);
|
||||
if (ObjectUtil.isNotEmpty(noinJoInfo)) {
|
||||
bom_qty = ((JSONObject) noinJoInfo.get(0)).getDoubleValue("noin_qty");
|
||||
}
|
||||
jo4.put(material_id, String.format("%.2f", noin_qty));
|
||||
|
||||
@@ -187,7 +206,6 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
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)) {
|
||||
@@ -217,24 +235,41 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
|
||||
if (canuse_num<0){
|
||||
jo5.put(material_id, DateUtil.offsetDay(date1, -1).toString().substring(0, 10));
|
||||
}else {
|
||||
for (int j = 1; j <= betweenDay; j++) {
|
||||
DateTime newDate = DateUtil.offsetDay(date1, j);
|
||||
//查询该物料当天的需求量
|
||||
JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time", newDate.toString().substring(0, 10) + "%").process().uniqueResult(0);
|
||||
double need_weight = 0;
|
||||
if (ObjectUtil.isNotEmpty(today_qty)) {
|
||||
need_weight = today_qty.getDoubleValue("qty");
|
||||
}
|
||||
if (canuse_num < need_weight) {
|
||||
jo5.put(material_id, DateUtil.offsetDay(newDate, -1).toString().substring(0, 10));
|
||||
break;
|
||||
} else {
|
||||
canuse_num -= need_weight;
|
||||
}
|
||||
if (j == betweenDay) {
|
||||
jo5.put(material_id, end_time.substring(0, 10));
|
||||
List<Object> materDataPlanQty = datePlanMap.get(material_id);
|
||||
double needWeight;
|
||||
jo5.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 (canuse_num < needWeight) {
|
||||
jo5.put(material_id, DateUtil.offsetDay(currentDate, -1).toString().substring(0, 10));
|
||||
break;
|
||||
} else {
|
||||
canuse_num -= needWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for (int j = 1; j <= betweenDay; j++) {
|
||||
// DateTime newDate = DateUtil.offsetDay(date1, j);
|
||||
// //查询该物料当天的需求量
|
||||
// JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time", newDate.toString().substring(0, 10) + "%").process().uniqueResult(0);
|
||||
// double need_weight = 0;
|
||||
// if (ObjectUtil.isNotEmpty(today_qty)) {
|
||||
// need_weight = today_qty.getDoubleValue("qty");
|
||||
// }
|
||||
// if (canuse_num < need_weight) {
|
||||
// jo5.put(material_id, DateUtil.offsetDay(newDate, -1).toString().substring(0, 10));
|
||||
// break;
|
||||
// } else {
|
||||
// canuse_num -= need_weight;
|
||||
// }
|
||||
// if (j == betweenDay) {
|
||||
// jo5.put(material_id, end_time.substring(0, 10));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
SUM( canuse_qty ) AS qty
|
||||
material_id,SUM( canuse_qty ) AS qty
|
||||
FROM
|
||||
st_ivt_structivt
|
||||
WHERE
|
||||
@@ -703,4 +703,103 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "10"
|
||||
QUERY
|
||||
SELECT
|
||||
dtl.material_id,
|
||||
b.currentDate,
|
||||
ROUND((b.qty * dtl.standard_rate * 0.01),3) as qty
|
||||
FROM (
|
||||
SELECT
|
||||
material_id,SUM( qty ) AS qty,currentDate
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
material_id,
|
||||
workorder_qty AS qty,
|
||||
wo.planstart_time as currentDate
|
||||
FROM
|
||||
pdm_bi_workorder wo
|
||||
WHERE wo.`status` < 50 AND is_delete = '0'
|
||||
OPTION 输入.begin_time <> ""
|
||||
wo.planstart_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
wo.planstart_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
UNION ALL
|
||||
SELECT
|
||||
material_id,
|
||||
product_weight AS qty,
|
||||
planstart_date as currentDate
|
||||
FROM
|
||||
MPS_BD_ProductDailyPlan
|
||||
WHERE `status` = '01'
|
||||
OPTION 输入.begin_time <> ""
|
||||
planstart_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
planstart_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
) a GROUP BY a.material_id,currentDate
|
||||
) b
|
||||
LEFT JOIN md_pd_productbom mst ON mst.material_id = b.material_id
|
||||
LEFT JOIN md_pd_productbomdtl dtl ON mst.bom_id = dtl.bom_id
|
||||
WHERE
|
||||
1=1 order by currentDate
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
mb.material_id,
|
||||
mb.material_name,
|
||||
mb.material_code,
|
||||
class.parent_class_id,
|
||||
(case when class.class_id = '1503644362192588800' then 1
|
||||
when class.class_id = '1503644361664106496' then 2
|
||||
when class.class_id = '1503644362788179968' then 4
|
||||
when class.class_id = '1503644362234531840' then 5
|
||||
else 3 end) AS order_no
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
wo.material_id
|
||||
FROM
|
||||
pdm_bi_workorder wo
|
||||
WHERE
|
||||
wo.is_delete = '0'
|
||||
AND wo.`status` IN ( '10', '20', '30' )
|
||||
OPTION 输入.begin_time <> ""
|
||||
wo.planstart_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
wo.planstart_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
UNION
|
||||
SELECT
|
||||
plan.material_id
|
||||
FROM
|
||||
mps_bd_productdailyplan plan
|
||||
WHERE
|
||||
plan.`status` = '01'
|
||||
OPTION 输入.begin_time <> ""
|
||||
plan.planstart_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
plan.planstart_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
) a
|
||||
LEFT JOIN md_pd_productbom bom ON bom.material_id = a.material_id
|
||||
LEFT JOIN md_pd_productbomdtl dtl ON dtl.bom_id = dtl.bom_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
ORDER BY order_no,material_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="统计日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item"/>
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属组织">
|
||||
<el-select
|
||||
@@ -31,49 +31,58 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation/>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
</crudOperation>
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:row-class-name="tableRowClassName"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
:max-height="590"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<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">
|
||||
<el-table-column v-if="col.prop !== '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip/>
|
||||
<el-table-column v-if="col.prop === '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip fixed/>
|
||||
<el-table-column v-if="col.prop !== '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip />
|
||||
<el-table-column v-if="col.prop === '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip fixed />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<el-table
|
||||
ref="dtl_table"
|
||||
v-loading="crud.loading"
|
||||
:row-class-name="tableRowClassName"
|
||||
:data="dtlList"
|
||||
size="mini"
|
||||
:max-height="590"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<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 cols2">
|
||||
<el-table-column v-if="!col.option" :prop="col.prop" :label="col.label" width="120px" />
|
||||
<el-table-column v-if="col.option" :prop="col.prop" :label="col.label" width="120px" fixed/>
|
||||
<el-table-column v-if="col.option" :prop="col.prop" :label="col.label" width="120px" fixed />
|
||||
</template>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.el-table .warning-row {
|
||||
background: oldlace;
|
||||
}
|
||||
|
||||
.el-table .success-row {
|
||||
background: #f0f9eb;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import report from '@/api/wms/statistics/report'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
@@ -132,7 +141,6 @@ export default {
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
debugger
|
||||
report.getHeader().then(res => {
|
||||
this.cols = res
|
||||
})
|
||||
@@ -165,6 +173,12 @@ export default {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
tableRowClassName({ row, rowIndex }) {
|
||||
if (rowIndex % 2 === 1) {
|
||||
return 'success-row'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user