This commit is contained in:
2022-09-02 14:08:43 +08:00
parent 86117a04ee
commit ce6ce0717b
22 changed files with 406 additions and 110 deletions

View File

@@ -4,6 +4,7 @@ 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.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -147,6 +148,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
map.put("update_time", now);
map.put("realproduceend_date", now);
wo.update(map, "produceorder_id = '" + ext_order_id + "'");
JSONObject jsonObject = wo.query("produceorder_id = '" + ext_order_id + "'").uniqueResult(0);
String real_qty = jsonObject.getString("real_qty");
if (StrUtil.isEmpty(real_qty)){
real_qty = "0";
}
//同时修改工单记录表中的期末数量及完成数量
WQLObject wo_record = WQLObject.getWQLObject("MPS_BD_MacOperateRecord");
JSONObject result1 = wo_record.query("produceorder_id = '" + ext_order_id + "' and (operatetime_end = '' or operatetime_end is null) ").uniqueResult(0);
result1.put("finish_qty",real_qty);
result1.put("finishproduct_qty",real_qty);
result1.put("operatetime_end",now);
wo_record.update(result1);
} catch (Exception e){
result.put("status", 400);
result.put("message", e.getMessage());

View File

@@ -417,7 +417,7 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
int nowproductivity = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "13").addParam("workprocedure_id", workprocedure_id).addParam("produce_date", today)
.process().uniqueResult(0).getIntValue("real_qty");
BigDecimal teep = new BigDecimal(0);
if (nowproductivity != 0) {
if (nowproductivity != 0 && Maxproductivity > 0) {
teep = NumberUtil.round(NumberUtil.div(nowproductivity * 100, Maxproductivity), 2);
}

View File

@@ -319,7 +319,7 @@
SELECT
device.productivity,
CASE WHEN TIMESTAMPDIFF( HOUR, realproducestart_date, now( ) ) = '0' THEN device.productivity
ELSE device.productivity * TIMESTAMPDIFF( HOUR, realproducestart_date, now( ) ) END AS max_productivity,
ELSE device.productivity * (TIMESTAMPDIFF( HOUR, realproducestart_date, now( ) ) + 1) END AS max_productivity,
shiftorder.produceorder_code,
shiftorder.realproducestart_date
FROM

View File

@@ -408,6 +408,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
JSONObject row = param.getJSONObject("row");
//强制完成时修改工单状态
String produceorder_id = row.getString("produceorder_id");
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
JSONObject produceorderMap = new JSONObject();
@@ -419,6 +420,20 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
produceorderMap.put("update_time", now);
produceorderMap.put("realproduceend_date", now);
wo.update(produceorderMap);
JSONObject jsonObject = wo.query("produceorder_id = '" + produceorder_id + "'").uniqueResult(0);
String real_qty = jsonObject.getString("real_qty");
if (StrUtil.isEmpty(real_qty)){
real_qty = "0";
}
//同时修改工单记录表中的期末数量及完成数量
WQLObject wo_record = WQLObject.getWQLObject("MPS_BD_MacOperateRecord");
JSONObject result = wo_record.query("produceorder_id = '" + produceorder_id + "' and (operatetime_end = '' or operatetime_end is null) ").uniqueResult(0);
if (ObjectUtil.isNotEmpty(result)){
result.put("finish_qty",real_qty);
result.put("finishproduct_qty",real_qty);
result.put("operatetime_end",now);
wo_record.update(result);
}
//wms向acs发送请求 工单强制完成
// TODO
JSONArray array = new JSONArray();

View File

@@ -135,11 +135,14 @@
workprocedure.workprocedure_name,
material.material_code,
material.material_name,
material.material_spec
material.material_spec,
device.device_code,
device.device_name
FROM
MPS_BD_ProduceShiftOrder shiftOrder
left join PDM_BI_WorkProcedure workprocedure on workprocedure.workprocedure_id = shiftOrder.workprocedure_id
left join md_me_materialbase material on material.material_id = shiftOrder.material_id
left join pdm_bi_device device on device.device_id = shiftOrder.device_id
WHERE
shiftOrder.is_delete = '0' and shiftOrder.order_status in ('01', '02', '03')
and shiftOrder.workprocedure_id in 输入.workprocedure_ids

View File

@@ -29,7 +29,7 @@
<el-table
ref="table"
:data="tableData"
size="small"
size="mini"
style="width: 100%;"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@@ -37,26 +37,27 @@
>
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="produceorder_id" label="生产班次工单标识" />
<el-table-column prop="produceorder_code" label="工单编号" width="130px" />
<el-table-column prop="order_status" label="工单状态">
<el-table-column prop="produceorder_code" label="工单编号" min-width="100px" />
<el-table-column prop="order_status" label="工单状态" min-width="100px">
<template slot-scope="scope">
{{ dict.label.MPS_BD_ORDERSTATUS[scope.row.order_status] }}
</template>
</el-table-column>
<el-table-column prop="shift_type_scode" label="班次类型">
<el-table-column prop="shift_type_scode" label="班次类型" min-width="90px">
<template slot-scope="scope">
{{ dict.label.PDM_BI_SHIFTTYPE[scope.row.shift_type_scode] }}
</template>
</el-table-column>
<el-table-column v-if="false" prop="workprocedure_id" label="工序标识" />
<el-table-column prop="produce_date" label="生产日期" width="100px" />
<el-table-column prop="plan_qty" label="计划数量" />
<el-table-column prop="report_qty" label="完工数量" />
<el-table-column v-if="false" prop="material_id" label="物料标识" />
<el-table-column prop="material_code" label="物料编码" width="100" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" width="100" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" width="100" show-overflow-tooltip />
<el-table-column prop="realproducestart_date" label="开始时间" width="150" />
<el-table-column prop="material_code" label="物料编码" min-width="100" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" min-width="100" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="100" show-overflow-tooltip />
<el-table-column prop="device_name" label="生产设备" min-width="100" show-overflow-tooltip />
<el-table-column prop="plan_qty" label="计划数量" min-width="80px" />
<el-table-column prop="real_qty" label="实际数量" min-width="80px" />
<el-table-column prop="produce_date" label="生产日期" min-width="100px" />
<el-table-column prop="realproducestart_date" label="开始时间" min-width="150" />
</el-table>
<!--分页组件-->
@@ -64,7 +65,7 @@
<el-dialog
title="请绑定设备"
:visible.sync="devicedialogVisible"
width="35%"
width="350px"
:before-close="handleClose">
<el-form :model="deviceForm" status-icon label-width="90px" ref="deviceForm" class="demo-ruleForm">
<el-form-item label="选择设备" prop="device_id">
@@ -95,7 +96,7 @@
:visible.sync="reportdialogVisibler"
width="35%"
:before-close="handleClose">
<el-form :model="reportForm" status-icon ref="reportForm" label-width="90px" class="demo-ruleForm">
<el-form :model="reportForm" status-icon ref="reportForm" label-width="70px" class="demo-ruleForm">
<el-form-item label="生产数量" prop="produce_qty">
<el-input disabled v-model="reportForm.produce_qty" />
</el-form-item>

View File

@@ -162,8 +162,8 @@
type="danger"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
@click="forceFinish(crud.selections[0])"
:disabled="is_finished(crud.selections)"
@click="forceFinish(crud.selections)"
>
强制完成
</el-button>
@@ -266,8 +266,8 @@
style="width: 200px"
clearable
filterable
@change="change"
placeholder="请选择"
@change="change"
>
<el-option
v-for="item in dict.PDM_BI_SHIFTTYPE"
@@ -623,11 +623,24 @@ export default {
}
},
// 强制完成
forceFinish(data) {
forceFinish(rows) {
var i = Number(0)
rows.forEach((item) => {
crudProduceshiftorder.forceFinish({ row: item }).then(res => {
i = i + 1
if (i === rows.length) {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}
})
})
/*
crudProduceshiftorder.forceFinish({ row: data }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
})*/
},
// 取两位小数点
rounding(row, column) {
@@ -651,6 +664,25 @@ export default {
return true
}
},
// 强制完成禁用条件
is_finished(rows) {
var length = rows.length
if (length > 1) {
var flag = false
for (let i = 0; i < rows.length; i++) {
if (rows[i].order_status === '04') {
flag = true
break
}
}
return flag
} else if (length === 1 && rows[0].order_status !== '04') {
return false
} else {
return true
}
},
// 新增编辑给form表单物料相关信息赋值
setMaterValue(row) {
this.form.material_id = row.material_id
@@ -666,13 +698,17 @@ export default {
},
// 下发
submits(rows) {
var i = Number(0)
rows.forEach((item) => {
var produceorder_id = item.produceorder_id
crudProduceshiftorder.submits({ produceorder_id: produceorder_id }).then(res => {
i = i + 1
if (i === rows.length) {
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}
})
})
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
},
add() {
this.addShow = true