|
@@ -8,14 +8,6 @@
|
|
|
draggable
|
|
|
>
|
|
|
<div class="form-container">
|
|
|
- <el-row :gutter="20" style="margin: 20px 0 0 38px">
|
|
|
- <el-col :span="9">
|
|
|
- <span>产品描述</span>
|
|
|
- <span style="margin-left: 10px">{{
|
|
|
- detailsRow.productDescription
|
|
|
- }}</span>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
<el-form
|
|
|
ref="wasteRecyclingRef"
|
|
|
class="master-container"
|
|
@@ -25,15 +17,38 @@
|
|
|
:rules="rules"
|
|
|
>
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="参考批号" label-width="90px">
|
|
|
+ <el-col :span="15">
|
|
|
+ <el-form-item label="产品描述" label-width="90px">
|
|
|
<el-input
|
|
|
- v-model.trim="detailsRow.lotCode"
|
|
|
+ v-model.trim="detailsRow.productDescription"
|
|
|
:disabled="true"
|
|
|
+ style="width: 250px"
|
|
|
>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="9">
|
|
|
+ <el-form-item
|
|
|
+ label="领料部门"
|
|
|
+ label-width="90px"
|
|
|
+ prop="requisitionDepartmentId"
|
|
|
+ >
|
|
|
+ <el-select-v2
|
|
|
+ v-model="form.requisitionDepartmentId"
|
|
|
+ :options="deptList"
|
|
|
+ placeholder="请选择领料工段"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="参考批号" label-width="90px">
|
|
|
+ <el-input v-model.trim="detailsRow.lotCode" :disabled="true">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="生成批数" label-width="90px" prop="lotNumber">
|
|
|
<el-input
|
|
@@ -44,8 +59,12 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="单批量" label-width="90px" prop="productionQuantity">
|
|
|
- <el-input-number
|
|
|
+ <el-form-item
|
|
|
+ label="单批量"
|
|
|
+ label-width="90px"
|
|
|
+ prop="productionQuantity"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
v-model="form.productionQuantity"
|
|
|
controls-position="right"
|
|
|
style="width: 150px"
|
|
@@ -71,7 +90,7 @@
|
|
|
<span style="font-size: 18px; font-weight: 700; line-height: 25px"
|
|
|
>工序</span
|
|
|
>
|
|
|
- <!-- <div style="float: inline-end">
|
|
|
+ <div style="float: inline-end">
|
|
|
<span
|
|
|
style="
|
|
|
color: rgba(0, 203, 117, 1);
|
|
@@ -97,7 +116,7 @@
|
|
|
@click="handleAddProcess"
|
|
|
>+从工序库添加</span
|
|
|
>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div id="insideProcessForm">
|
|
|
<el-table
|
|
@@ -166,7 +185,9 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { getLastLot } from "@/api/business/lot";
|
|
|
+import { getLastLot, getProcess, addWasteRecycling } from "@/api/business/lot";
|
|
|
+import { listDeptProcess } from "@/api/business/deptProcess";
|
|
|
+import { getDeptList } from "@/api/system/dept";
|
|
|
import processChoice from "./DialogProcessChoice";
|
|
|
import { onMounted, ref } from "vue";
|
|
|
import Sortable from "sortablejs";
|
|
@@ -179,12 +200,14 @@ const processLoading = ref(false);
|
|
|
const total = ref(0);
|
|
|
const visible = ref(false);
|
|
|
const detailsRow = ref({});
|
|
|
+const deptList = ref([]);
|
|
|
const processList = ref([]);
|
|
|
const referenceLotInfo = ref({});
|
|
|
//校验生成批数
|
|
|
const validateLotNumber = (rule, value, callback) => {
|
|
|
const min = 0;
|
|
|
- if (value %1 !== 0) { // 检查是否无法解析为整数
|
|
|
+ if (value % 1 !== 0) {
|
|
|
+ // 检查是否无法解析为整数
|
|
|
callback(new Error(`当前生成批数不能是小数`));
|
|
|
} else if (value <= min) {
|
|
|
callback(new Error("当前生成批数应大于0"));
|
|
@@ -195,7 +218,7 @@ const validateLotNumber = (rule, value, callback) => {
|
|
|
//校验单批量
|
|
|
const validateproductionQuantity = (rule, value, callback) => {
|
|
|
const min = 0;
|
|
|
- if (value %1 !== 0) {
|
|
|
+ if (value % 1 !== 0) {
|
|
|
callback(new Error(`当前单批量不能是小数`));
|
|
|
} else if (value <= min) {
|
|
|
callback(new Error("当前单批量应大于0"));
|
|
@@ -222,6 +245,9 @@ const data = reactive({
|
|
|
{ required: true, message: "单批量不能为空", trigger: "blur" },
|
|
|
{ validator: validateproductionQuantity, trigger: "blur" },
|
|
|
],
|
|
|
+ requisitionDepartmentId: [
|
|
|
+ { required: true, message: "领料部门不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
},
|
|
|
});
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
@@ -231,6 +257,9 @@ const { queryParams, form, rules } = toRefs(data);
|
|
|
const open = (data) => {
|
|
|
reset();
|
|
|
detailsRow.value = proxy.deepClone(data[0]);
|
|
|
+ getDeptList({ type: 0, isWorkSection: 1 }).then((res) => {
|
|
|
+ deptList.value = res.data;
|
|
|
+ });
|
|
|
processList.value = [];
|
|
|
console.log(detailsRow.value);
|
|
|
visible.value = true;
|
|
@@ -248,6 +277,7 @@ const reset = () => {
|
|
|
referenceLot: null,
|
|
|
lotNumber: null,
|
|
|
productionQuantity: null,
|
|
|
+ requisitionDepartmentId: null,
|
|
|
};
|
|
|
proxy.resetForm("wasteRecyclingRef");
|
|
|
};
|
|
@@ -294,70 +324,120 @@ function handleDeleteProcess(row) {
|
|
|
const handleSave = () => {
|
|
|
proxy.$refs["wasteRecyclingRef"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- var wasteRecyclingInfo = {}
|
|
|
+ var wasteRecyclingInfo = {};
|
|
|
for (var i = 0; i < processList.value.length; i++) {
|
|
|
- processList.value[i].processStepNumber= 1000 + i * 10;
|
|
|
+ processList.value[i].processStepNumber = 1000 + i * 10;
|
|
|
}
|
|
|
wasteRecyclingInfo.lotCodeList = form.value.newLots;
|
|
|
- wasteRecyclingInfo.productionPlanDetailId = detailsRow.value.productionPlanDetailId
|
|
|
- wasteRecyclingInfo.technologicalProcessId = referenceLotInfo.value.technologicalProcessId
|
|
|
- wasteRecyclingInfo.technologyVersion = referenceLotInfo.value.technologyVersion
|
|
|
- wasteRecyclingInfo.productId = detailsRow.value.product.id
|
|
|
- wasteRecyclingInfo.productionQuantity = form.value.productionQuantity
|
|
|
- wasteRecyclingInfo.processList = processList.value
|
|
|
- //废品回用的批号
|
|
|
- wasteRecyclingInfo.lotCode = detailsRow.value.lotCode
|
|
|
- console.log(wasteRecyclingInfo)
|
|
|
- //保存废品回用
|
|
|
-
|
|
|
+ wasteRecyclingInfo.productionPlanDetailId =
|
|
|
+ detailsRow.value.productionPlanDetailId;
|
|
|
+ wasteRecyclingInfo.technologicalProcessId =
|
|
|
+ detailsRow.value.technologicalProcessId;
|
|
|
+ wasteRecyclingInfo.technologyVersion = detailsRow.value.technologyVersion;
|
|
|
+ wasteRecyclingInfo.productId = detailsRow.value.product.id;
|
|
|
+ wasteRecyclingInfo.productionQuantity = form.value.productionQuantity;
|
|
|
+ wasteRecyclingInfo.productDescription =
|
|
|
+ detailsRow.value.productDescription;
|
|
|
+ wasteRecyclingInfo.processList = processList.value;
|
|
|
+ wasteRecyclingInfo.lotCode = detailsRow.value.lotCode;
|
|
|
+ wasteRecyclingInfo.requisitionDepartmentId =
|
|
|
+ form.value.requisitionDepartmentId;
|
|
|
+ for (let i = 0; i < processList.value.length; i++) {
|
|
|
+ if (form.value.requisitionDepartmentId == deptList.value[i].value) {
|
|
|
+ wasteRecyclingInfo.requisitionDepartmentName =
|
|
|
+ deptList.value[i].label;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(wasteRecyclingInfo);
|
|
|
+ //判断工序除了processId = 1 和等于2的工序,当前领料部门是否能干第一道序
|
|
|
+ const filteredProcessList = processList.value.filter((item) => {
|
|
|
+ return item.processId != 1 && item.processId != 2;
|
|
|
+ });
|
|
|
+ //该工段能干的工序
|
|
|
+ listDeptProcess({
|
|
|
+ getFlag: "true",
|
|
|
+ deptId: form.value.requisitionDepartmentId,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ var deptProcess = res.rows;
|
|
|
+ var flag = false;
|
|
|
+ console.log(deptProcess);
|
|
|
+ console.log(filteredProcessList[0].processAlias)
|
|
|
+ console.log(filteredProcessList[0].processAlias,deptProcess[0].processAlias)
|
|
|
+ for (var i = 0; i < deptProcess.length; i++) {
|
|
|
+ if (
|
|
|
+ filteredProcessList[0].processId == deptProcess[i].processId
|
|
|
+ ) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ //保存废品回用
|
|
|
+ addWasteRecycling(wasteRecyclingInfo).then((response) => {
|
|
|
+ if (response.code == 200) {
|
|
|
+ proxy.$modal.msgSuccess("添加废品回用成功");
|
|
|
+ handleCancel();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ proxy.$modal.msgError("当前领料部门不能干首序");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-/**参考批次带回 */
|
|
|
-function handleLotSelected(selection) {
|
|
|
- console.log(selection);
|
|
|
- referenceLotInfo.value = selection;
|
|
|
- form.value.referenceLot = selection.lotCode;
|
|
|
- processList.value = []
|
|
|
-}
|
|
|
/**添加历史工艺 */
|
|
|
function handleAddPreProcess() {
|
|
|
currentUID = processList.value.length + 1;
|
|
|
- processList.value = []
|
|
|
- for(var i = 0; i < referenceLotInfo.value.technologicalProcessDetailList.length; i++) {
|
|
|
- let process = {}
|
|
|
- process.technologicalProcessId = referenceLotInfo.value.technologicalProcessId
|
|
|
- process.technologyVersion = referenceLotInfo.value.technologyVersion
|
|
|
- process.productId = detailsRow.value.product.id
|
|
|
- process.productCode = referenceLotInfo.value.technologicalProcessDetailList[i].productCode
|
|
|
- process.processId = referenceLotInfo.value.technologicalProcessDetailList[i].processId
|
|
|
- process.processKey = referenceLotInfo.value.technologicalProcessDetailList[i].processKey
|
|
|
- process.processCode = referenceLotInfo.value.technologicalProcessDetailList[i].processCode
|
|
|
- process.processAlias = referenceLotInfo.value.technologicalProcessDetailList[i].processAlias
|
|
|
- process.productShaftCategory = referenceLotInfo.value.technologicalProcessDetailList[i].productShaftCategory
|
|
|
- process.productShaftCategoryName = referenceLotInfo.value.productShaftCategoryName
|
|
|
- process.productDescription = referenceLotInfo.value.technologicalProcessDetailList[i].productDescription
|
|
|
- process.uuid = currentUID++;
|
|
|
- processList.value.push(process)
|
|
|
- }
|
|
|
- console.log(processList.value)
|
|
|
-
|
|
|
- rowDrop()
|
|
|
+ processList.value = [];
|
|
|
+ getProcess({
|
|
|
+ id: detailsRow.value.lotId,
|
|
|
+ isAmend: detailsRow.value.isAmend,
|
|
|
+ isWasteRecycling: detailsRow.value.isWasteRecycling,
|
|
|
+ technologicalProcessId: detailsRow.value.technologicalProcessId,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ referenceLotInfo.value = res.data;
|
|
|
+ for (var i = 0; i < referenceLotInfo.value.length; i++) {
|
|
|
+ let process = {};
|
|
|
+ process.technologyVersion = detailsRow.value.technologyVersion;
|
|
|
+ process.productId = detailsRow.value.product.id;
|
|
|
+ process.productCode = referenceLotInfo.value[i].productCode;
|
|
|
+ process.processId = referenceLotInfo.value[i].processId;
|
|
|
+ process.processKey = referenceLotInfo.value[i].processKey;
|
|
|
+ process.processCode = referenceLotInfo.value[i].processCode;
|
|
|
+ process.processAlias = referenceLotInfo.value[i].processAlias;
|
|
|
+ process.productShaftCategory =
|
|
|
+ referenceLotInfo.value[i].productShaftCategory;
|
|
|
+ process.productShaftCategoryName =
|
|
|
+ referenceLotInfo.value[i].productShaftCategoryName;
|
|
|
+ process.productDescription =
|
|
|
+ referenceLotInfo.value[i].productDescription;
|
|
|
+ process.uuid = currentUID++;
|
|
|
+ processList.value.push(process);
|
|
|
+ }
|
|
|
+ rowDrop();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
/** 行拖拽 */
|
|
|
function rowDrop() {
|
|
|
// 要侦听拖拽响应的DOM对象
|
|
|
- const tbody = document.querySelector('#insideProcessForm .el-table__body-wrapper tbody')
|
|
|
+ const tbody = document.querySelector(
|
|
|
+ "#insideProcessForm .el-table__body-wrapper tbody"
|
|
|
+ );
|
|
|
Sortable.create(tbody, {
|
|
|
// 指定父元素下可被拖拽的子元素
|
|
|
- handle: '.move-handle',
|
|
|
+ handle: ".move-handle",
|
|
|
// 结束拖拽后的回调函数
|
|
|
onEnd({ newIndex, oldIndex }) {
|
|
|
- const currentRow = processList.value.splice(oldIndex, 1)[0]
|
|
|
- processList.value.splice(newIndex, 0, currentRow)
|
|
|
- }
|
|
|
- })
|
|
|
+ const currentRow = processList.value.splice(oldIndex, 1)[0];
|
|
|
+ processList.value.splice(newIndex, 0, currentRow);
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**工序库添加工序 */
|
|
@@ -367,27 +447,28 @@ function handleAddProcess() {
|
|
|
|
|
|
/**工序库添加工序带回 */
|
|
|
function handleProcessSelected(selection) {
|
|
|
- console.log(detailsRow.value.product)
|
|
|
+ console.log(detailsRow.value.product);
|
|
|
currentUID = processList.value.length + 1;
|
|
|
for (var i = 0; i < selection.length; i++) {
|
|
|
var processAdd = {};
|
|
|
//工艺从参考工艺取
|
|
|
- processAdd.technologicalProcessId = referenceLotInfo.value.technologicalProcessId
|
|
|
- processAdd.technologyVersion = referenceLotInfo.value.technologyVersion
|
|
|
+ processAdd.technologyVersion = detailsRow.value.technologyVersion;
|
|
|
processAdd.productId = detailsRow.value.product.id;
|
|
|
processAdd.productCode = detailsRow.value.product.productCode;
|
|
|
processAdd.processId = selection[i].id;
|
|
|
processAdd.processAlias = selection[i].processAlias;
|
|
|
processAdd.processCode = selection[i].processCode;
|
|
|
- processAdd.productShaftCategory =detailsRow.value.product.shaftCategoryCode;
|
|
|
- processAdd.productShaftCategoryName = referenceLotInfo.value.productShaftCategoryName;
|
|
|
+ processAdd.productShaftCategory =
|
|
|
+ detailsRow.value.product.shaftCategoryCode;
|
|
|
+ processAdd.productShaftCategoryName =
|
|
|
+ detailsRow.value.productShaftCategoryName;
|
|
|
processAdd.processKey = selection[i].processKey;
|
|
|
- processAdd.productDescription = referenceLotInfo.value.productDescription
|
|
|
+ processAdd.productDescription = detailsRow.value.productDescription;
|
|
|
processAdd.uuid = currentUID++;
|
|
|
processList.value.push(processAdd);
|
|
|
}
|
|
|
console.log(processList.value);
|
|
|
- rowDrop()
|
|
|
+ rowDrop();
|
|
|
}
|
|
|
/** 获取行 id */
|
|
|
function getRowKey(row) {
|