Browse Source

add: 强制完成前的确认

master
李永德 2 years ago
parent
commit
27b0ec1436
  1. 19
      lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java
  2. 4
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java
  3. 59
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

19
lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java

@ -110,15 +110,26 @@ public class PointUpdateUtil {
devices.add(device);
// 向ACS查询点位状态
JSONObject deviceStatus = wmsToAcsService.getPointStatus(devices);
if (ObjectUtil.isEmpty(deviceStatus.get("data"))) return DeviceStatusEnum.SHUTDOWN.getCode();
JSONArray statusJSONArray = deviceStatus.getJSONArray("data");
if (ObjectUtil.isEmpty(statusJSONArray)) return DeviceStatusEnum.SHUTDOWN.getCode();
if (ObjectUtil.isEmpty(deviceStatus.get("data"))) {
return DeviceStatusEnum.SHUTDOWN.getCode();
}
JSONArray statusJSONArray = null;
try {
statusJSONArray = deviceStatus.getJSONArray("data");
} catch (Exception e) {
return DeviceStatusEnum.SHUTDOWN.getCode();
}
if (ObjectUtil.isEmpty(statusJSONArray)) {
return DeviceStatusEnum.SHUTDOWN.getCode();
}
JSONObject deviceJson = statusJSONArray.getJSONObject(0);
String point_code = deviceJson.getString("device_code");
String mode = deviceJson.getString("mode"); // 工作状态:0脱机,其他正常
String error = deviceJson.getString("error"); // 0是正常
log.info("device_code: " + point_code + ", mode: " + mode + ", error: " + error);
if (!error.equals("0")) return DeviceStatusEnum.FAILURE.getCode();
if (!error.equals("0")) {
return DeviceStatusEnum.FAILURE.getCode();
}
return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode();
}
}

4
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java

@ -215,8 +215,8 @@ public class CockpitServiceImpl implements CockpitService{
Duration duration = Duration.between(dateTime, now);
d.setWork_time(duration.toHours() + "");
}
// 设备状态
// d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code()));
// 设置设备状态
d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code()));
DeviceEnum deviceEnum = DeviceEnum.get(d.getDevice_model(), d.getDevice_code());
// 添加图片名字
d.setDevice_url(deviceEnum.getPictureName());

59
lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

@ -237,6 +237,50 @@
<MaterDtl :dialog-show.sync="materialShow" :is-single="true" @setMaterValue="setMaterValue" />
<DeviceDialog :dialog-show.sync="deviceShow" :is-single="true" @tableChanged="tableChanged" />
<ViewDialog ref="child3" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:visible.sync="finishShow"
title="强制完成"
width="600px"
>
<el-form ref="form" :model="orderData" :rules="rules" size="mini" label-width="160px" label-suffix="">
<el-row>
<el-col :span="12">
<el-form-item label="实际数量" prop="material_id">
<el-input-number
style="width: 150px"
v-model="orderData.qty"
:min="0"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="合格数量" prop="qualified_qty">
<el-input-number
style="width: 150px"
v-model="orderData.qualified_qty"
:min="0"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="不合格数量" prop="unqualified_qty">
<el-input-number
style="width: 150px"
v-model="orderData.unqualified_qty"
:min="0"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="cancelFinish">取消</el-button>
<el-button type="primary" @click="toForceFinish">确认</el-button>
</div>
</el-dialog>
</div>
</template>
@ -328,6 +372,8 @@ export default {
workprocedureList: [],
order_status: ['-1'],
permission: {},
orderData: {},
finishShow: false,
rules: {
plan_qty: [
{ required: true, message: '计划数量不能为空', trigger: 'blur' }
@ -369,9 +415,20 @@ export default {
this.$refs.child3.setForm(row)
}
},
clearForm() {
this.orderData = {}
},
cancelFinish() {
this.clearForm()
this.finishShow = false
},
//
forceFinish(data) {
crudWorkorder.forceFinish({ row: data }).then(res => {
this.orderData = data
this.finishShow = true
},
toForceFinish() {
crudWorkorder.forceFinish({ row: this.orderData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})

Loading…
Cancel
Save