This commit is contained in:
zds
2022-11-09 11:31:41 +08:00
parent 305f6942ee
commit a9417c3800
3 changed files with 64 additions and 33 deletions

View File

@@ -113,21 +113,26 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
jo8.put("1", "采购缺口"); jo8.put("1", "采购缺口");
rows.add(jo8); rows.add(jo8);
//汇总所有配方明细物料
HashMap<String,Double> dtlJa_map = new HashMap<String,Double>();
JSONArray dtlJa = WQL.getWO("statistical_report_query_01").addParam("flag", "5").process().getResultJSONArray(0);
for (int i = 0; i < dtlJa.size(); i++) {
JSONObject form_qty = dtlJa.getJSONObject(i);
dtlJa_map.put(form_qty.getString("material_id"),form_qty.getDouble("qty"));
}
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");
//1、库存现存量现有库存 - 开单领料重量 //1、库存现存量现有库存 - 开单领料重量
JSONObject mater_ivt = WQL.getWO("statistical_report_query_01").addParam("flag", "4").addParam("material_id", material_id).process().uniqueResult(0); JSONObject mater_ivt = WQL.getWO("statistical_report_query_01").addParam("flag", "4").addParam("material_id", material_id).process().uniqueResult(0);
//查询开单领料重量
JSONObject form_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "5").addParam("material_id", material_id).process().uniqueResult(0);
double now_ivt = 0; double now_ivt = 0;
double need_qty = 0; double need_qty = 0;
if (ObjectUtil.isNotEmpty(mater_ivt)) { if (ObjectUtil.isNotEmpty(mater_ivt)) {
now_ivt = mater_ivt.getDoubleValue("qty"); now_ivt = mater_ivt.getDoubleValue("qty");
} }
if (ObjectUtil.isNotEmpty(form_qty)) { if (dtlJa_map.containsKey(material_id)) {
need_qty = form_qty.getDoubleValue("qty"); need_qty = dtlJa_map.get(material_id);
} }
double canuse_num = NumberUtil.sub(now_ivt - need_qty).doubleValue(); double canuse_num = NumberUtil.sub(now_ivt - need_qty).doubleValue();
jo1.put(material_id, String.format("%.3f", canuse_num)); jo1.put(material_id, String.format("%.3f", canuse_num));

View File

@@ -245,43 +245,40 @@
IF 输入.flag = "5" IF 输入.flag = "5"
QUERY QUERY
SELECT SELECT
dtl.material_id, FormulaDtl.material_id,
SUM(ROUND((b.qty*dtl.standard_rate*0.01),3)) AS qty SUM( FormulaDtl.formula_qty ) AS qty
FROM FROM
(
SELECT
material_id,
SUM( qty ) AS qty
FROM
( (
SELECT SELECT
material_id, wo.workorder_id
workorder_qty AS qty
FROM FROM
pdm_bi_workorder wo pdm_bi_workorder wo
WHERE WHERE
wo.`status` = '40' wo.`status` = '40'
AND is_delete = '0' AND wo.is_delete = '0'
OPTION 输入.begin_time <> "" UNION ALL
wo.planstart_time >= 输入.begin_time SELECT
ENDOPTION workorder.workorder_id
OPTION 输入.end_time <> "" FROM
wo.planstart_time <= 输入.end_time pdm_bi_workorder workorder
ENDOPTION INNER JOIN PDM_BI_WorkTask WorkTask ON WorkTask.workorder_id = workorder.workorder_id
WHERE
workorder.`status` IN ( '50', '69', '97', '98' )
AND workorder.is_delete = '0'
AND WorkTask.STATUS <> '99'
) a ) a
GROUP BY LEFT JOIN PDM_BI_Formula Formula ON Formula.workorder_id = a.workorder_id
a.material_id LEFT JOIN PDM_BI_FormulaDtl FormulaDtl ON FormulaDtl.formula_id = Formula.formula_id and FormulaDtl.status<>'99'
) b where
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 1=1
OPTION 输入.material_id <> "" and Formula.is_delete='0'
dtl.material_id = 输入.material_id and Formula.status<>'99'
ENDOPTION OPTION 输入.material_id <> ""
GROUP BY FormulaDtl.material_id = 输入.material_id
dtl.material_id ENDOPTION
GROUP BY
FormulaDtl.material_id
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF

View File

@@ -122,6 +122,16 @@
> >
仓位同步 仓位同步
</el-button> </el-button>
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-printer"
size="mini"
@click="print"
>
打印
</el-button>
</crudOperation> </crudOperation>
<!--表单组件--> <!--表单组件-->
<el-dialog <el-dialog
@@ -268,6 +278,7 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill' import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
const defaultForm = { point_id: null, point_code: null, point_name: null, area_type: null, point_type: '00', point_status: '00', lock_type: '00', vehicle_code: null, source_id: null, remark: null, is_used: null, is_delete: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null } const defaultForm = { point_id: null, point_code: null, point_name: null, area_type: null, point_type: '00', point_status: '00', lock_type: '00', vehicle_code: null, source_id: null, remark: null, is_used: null, is_delete: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
export default { export default {
@@ -366,6 +377,24 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
print() {
const _selectData = this.$refs.table.selection
if (!_selectData || _selectData.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return
}
for (let i = 0; i < _selectData.length; i++) {
const code = _selectData[i].point_code
const LODOP = getLodop()
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
// 打印纸张大小设置https://www.it610.com/article/2094844.html
LODOP.SET_PRINT_PAGESIZE(1, '50mm', '30mm', '')
LODOP.ADD_PRINT_BARCODE('4.3mm', '8.2mm', '40mm', '20mm', '128Auto', code)
LODOP.PRINT()// 打印
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}
},
sync() { sync() {
this.syncLoading = true this.syncLoading = true
crudPoint.syncStruct().then(() => { crudPoint.syncStruct().then(() => {