guoyujia 1 rok temu
rodzic
commit
a1b5d179e8

+ 33 - 0
src/api/business/daywork.js

@@ -14,6 +14,26 @@ export function listDaywork(query) {
         params: query
     })
 }
+// 查询工序管理
+export function getDayworkProcessList (query) {
+    return request({
+      url: baseUrl + '/business/productionDaywork/getDayworkProcessList',
+      method: 'get',
+      params: query
+    })
+  }
+/**
+ * 获取 计划查询的工段列表
+ * @param {*} data
+ * @returns
+ */
+export function getDeptList(query) {
+    return request({
+        url: baseUrl + '/business/productionDaywork/getDeptList',
+        method: 'get',
+        params: query
+    })
+}
 /**
  * 获取 计划查询 列表
  * @param {*} data
@@ -27,6 +47,19 @@ export function getDayworkInfo(query) {
     })
 }
 
+/**
+ * 获取 已生产批次 列表
+ * @param {*} data
+ * @returns
+ */
+export function getProducedLot(query) {
+    return request({
+        url: baseUrl + '/business/productionDaywork/getProducedLot',
+        method: 'get',
+        params: query
+    })
+}
+
 /** 查询批次信息 */
 export function getDayworkItemProcess(id) {
     return request({

+ 69 - 0
src/api/business/lot.js

@@ -0,0 +1,69 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询计划查询列表
+export function listLot(query) {
+  return request({
+    url: baseUrl +'/business/lot/list',
+    method: 'get',
+    params: query
+  })
+}
+// 根据生产计划查询批次
+export function getLotInfo(query) {
+  return request({
+    url: baseUrl +'/business/lot/getLotInfo',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询计划查询详细
+export function getLot(id) {
+  return request({
+    url: baseUrl +'/business/lot/' + id,
+    method: 'get'
+  })
+}
+
+// 查询批次查询详细
+export function getLotList(query) {
+  return request({
+    url:baseUrl + '/business/lot/getLotList',
+    method: 'get',
+    params:query
+  })
+}
+
+// 新增计划查询
+export function addLot(data) {
+  return request({
+    url: baseUrl +'/business/lot',
+    method: 'post',
+    data: data
+  })
+}
+//查找对应计划单下最后一批
+export function getLastLot(query) {
+  return request({
+    url: baseUrl +'/business/lot/getLastLot',
+    method: 'get',
+    params: query
+  })
+}
+// 修改计划查询
+export function updateLot(data) {
+  return request({
+    url: baseUrl +'/business/lot',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除计划查询
+export function delLot(id) {
+  return request({
+    url: baseUrl +'/business/lot/' + id,
+    method: 'delete'
+  })
+}

+ 46 - 0
src/api/business/lotWaste.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询批次废弃列表
+export function listLotWaste(query) {
+  return request({
+    url:  baseUrl +'/business/lotWaste/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询批次废弃详细
+export function getLotWaste(data) {
+  return request({
+    url:  baseUrl +'/business/lotWaste/getLotWaste',
+    method: 'get',
+    data:data
+  })
+}
+
+// 新增批次废弃
+export function addLotWaste(data) {
+  return request({
+    url:  baseUrl +'/business/lotWaste',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改批次废弃
+export function updateLotWaste(data) {
+  return request({
+    url:  baseUrl +'/business/lotWaste',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除批次废弃
+export function delLotWaste(id) {
+  return request({
+    url:  baseUrl +'/business/lotWaste/' + id,
+    method: 'delete'
+  })
+}

+ 16 - 0
src/api/business/productionPlanDetail.js

@@ -22,6 +22,22 @@ export function listProductionPlanDetailList(query) {
   })
 }
 
+export function getTechnologicalVersion(query) {
+  return request({
+    url: baseUrl + '/business/productionPlanDetail/getTechnologicalVersion',
+    method: 'get',
+    params: query
+  })
+}
+
+export function getTechnologicalProcessDetailList(query) {
+  return request({
+    url: baseUrl + '/business/productionPlanDetail/getTechnologicalProcessDetailList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询生产计划明细详细
 export function getProductionPlanDetail(id) {
   return request({

+ 8 - 0
src/api/system/dept.js

@@ -81,6 +81,14 @@ export function addDept(data) {
   })
 }
 
+
+export function selectDeptInfo(data) {
+  return request({
+    url: baseUrl + '/system/dept/selectDeptInfo',
+    method: 'post',
+    data: data
+  })
+}
 // 修改部门
 export function updateDept(data) {
   return request({

+ 162 - 0
src/views/business/lot/DialogProcessChoice.vue

@@ -0,0 +1,162 @@
+<template>
+  <el-dialog title="添加工序" v-model="visible" width="800px" height="400px"   @close="close" append-to-body draggable>
+    <el-form ref="dialogForm" class="master-container" :model="queryParams" style="align-items: center;" >
+      <div style="display: flex;">
+        <el-form-item label="工序编码:" prop="processCode" label-width="100px" style="margin-top: 20px;">
+          <el-input
+            v-model.trim="queryParams.processCode"
+            type="text"
+            @keydown.enter.prevent
+            style="width: 180px"
+            placeholder="请输入工序编码"
+            :clearable="true"
+            @keyup.enter="handleSearch"
+          />
+        </el-form-item>
+        <el-form-item label="工序简称:" prop="processAlias" label-width="100px" style="margin-top: 20px;">
+          <el-input
+            v-model.trim="queryParams.processAlias"
+            type="text"
+            @keydown.enter.prevent
+            style="width: 180px"
+            placeholder="请输入工序简称"
+            :clearable="true"
+            @keyup.enter="handleSearch"
+          />
+        </el-form-item>
+        <el-form-item label-width="20px" style="margin-top: 20px;">
+          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+        </el-form-item>
+      </div>
+    </el-form>
+
+    <el-table
+      ref="dialogTable"
+      :data="processList"
+      :row-key="getRowKey"
+      size="small"
+      v-loading="loading"
+      border
+      height="370px"
+      header-row-class-name="list-header-row"
+      row-class-name="list-row"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="40" align="center" :reserve-selection="true" />
+      <el-table-column type="index" label="行号" width="50" align="center" />
+      <el-table-column label="工序编码" align="center" prop="processCode" />
+      <el-table-column label="工序简称" align="center" prop="processAlias" />
+      <el-table-column label="工序状态" align="center" prop="status">
+        <template #default="scope">
+          <dict-tag :options="process_status" :value="scope.row.status" />
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">确定</el-button>
+        <el-button icon="Close" @click="close">取 消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { ref } from '@vue/reactivity'
+import { listProcess } from '@/api/business/process'
+const { proxy } = getCurrentInstance()
+/** 字典数组区 */
+const { process_status } = proxy.useDict('process_status')
+/** 工序变量 */
+const total = ref(0)
+const props = defineProps({
+  multipleSelected: {
+    type: Function,
+    default: null
+  }
+})
+
+const { multipleSelected } = toRefs(props)
+const processList = ref([])
+const visible = ref(false)
+const loading = ref(false)
+const data = reactive({
+  queryParams: {
+    pageSize: 10,
+    pageNum: 1
+  }
+})
+const selections = ref([])
+const { queryParams } = toRefs(data)
+
+/** 获取行 id */
+function getRowKey(row) {
+  return row.id
+}
+
+/**
+ * 对话框打开 事件
+ */
+function open() {
+  visible.value = true
+  getList()
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  proxy.$refs.dialogForm.resetFields()
+  proxy.$refs.dialogTable.clearSelection()
+  queryParams.value.pageNum = 1
+  visible.value = false
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+  loading.value = true
+  queryParams.value.status = 'NA'
+  listProcess(queryParams.value).then((res) => {
+    processList.value = res.rows
+    total.value = res.total
+    loading.value = false
+  })
+}
+
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+  selections.value = selection
+}
+
+
+/**  搜索 事件 */
+function handleSearch(type) {
+  if (type && type === 'clear') {
+    queryParams.value = {
+      processCode:'',
+      processAlias: '',
+      total: 0,
+      pageSize: 10,
+      pageNum: 1
+    }
+  }
+  getList()
+}
+/** 多选事件 */
+function handleMultipleSelected() {
+  if (multipleSelected.value) {
+    multipleSelected.value(selections.value)
+  }
+  close()
+}
+
+defineExpose({
+  open
+})
+</script>
+<style scoped></style>

+ 59 - 0
src/views/business/lot/DialogTechnologyProcess.vue

@@ -0,0 +1,59 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-dialog title="生产计划表单" v-model="visible" width="800px" append-to-body draggable>
+    <div class="form-container">
+      <div style="margin: 20px 0 10px 0">
+        <span>工艺版本</span>
+        <span style="margin-left: 10px;color: red;">{{ detailsRow.technologyVersion }}</span>
+      </div>
+      <el-table
+      ref="dialogTable"
+      :data="technologyProcessDetailList"
+      row-key="id"
+      size="small"
+      v-loading="loading"
+      border
+      height="360px"
+      header-row-class-name="list-header-row"
+      row-class-name="list-row"
+    >
+      <el-table-column type="index" label="行号" width="50" align="center" />
+      <el-table-column label="工序步骤编号" width="100" align="center" prop="processStepNumber"/>
+      <el-table-column label="工序编码" align="center" prop="processCode" />
+      <el-table-column label="工序简称" align="center" prop="processAlias" />
+    </el-table>
+    </div>
+    <template #footer>
+      <el-button type="primary" icon="Check" @click="handleCancel">确 定</el-button>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { ref } from 'vue'
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['handleUpdateSuccess'])
+/**工艺版本变更变量 */
+const loading = ref(false)
+const total = ref(0)
+const visible = ref(false)
+const detailsRow = ref({})
+const technologyProcessDetailList = ref([])
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  visible.value = true
+  detailsRow.value = proxy.deepClone(data);
+  technologyProcessDetailList.value = detailsRow.value.technologicalProcessDetailList
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 406 - 0
src/views/business/lot/DialogWasteRecycling.vue

@@ -0,0 +1,406 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-dialog
+    title="废品回用"
+    v-model="visible"
+    width="900px"
+    append-to-body
+    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"
+        v-loading="loading"
+        :model="form"
+        label-width="100px"
+        :rules="rules"
+      >
+        <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
+                v-model="form.lotNumber"
+                style="width: 200px"
+                @input="handleUpdateLotNumber"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="单批量" label-width="90px" prop="productionQuantity">
+              <el-input-number 
+                v-model="form.productionQuantity"
+                controls-position="right"
+                style="width: 150px"
+                :min="0"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="24">
+            <el-form-item label="新生成批号" label-width="90px">
+              <el-input
+                type="textarea"
+                v-model.trim="form.newLots"
+                :disabled="true"
+                style="width: 660px"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div>
+        <span style="font-size: 18px; font-weight: 700; line-height: 25px"
+          >工序</span
+        >
+        <!-- <div style="float: inline-end">
+          <span
+            style="
+              color: rgba(0, 203, 117, 1);
+              font-size: 16px;
+              font-weight: 400;
+              line-height: 23px;
+              cursor: pointer;
+              display: inline-block;
+            "
+            @click="handleAddPreProcess"
+            >+从历史工艺添加</span
+          >
+          <span
+            style="
+              margin-left: 30px;
+              color: rgba(232, 122, 0, 1);
+              font-size: 16px;
+              font-weight: 400;
+              line-height: 23px;
+              cursor: pointer;
+              display: inline-block;
+            "
+            @click="handleAddProcess"
+            >+从工序库添加</span
+          >
+        </div> -->
+      </div>
+      <div id="insideProcessForm">
+        <el-table
+          class="elTable"
+          ref="dialogTable"
+          :data="processList"
+          :row-key="getRowKey"
+          size="small"
+          v-loading="loading"
+          border
+          height="360px"
+          header-row-class-name="list-header-row"
+          row-class-name="currentRow"
+        >
+          <el-table-column label="移动" width="50" align="center">
+            <div class="move-handle">
+              <el-icon>
+                <Rank />
+              </el-icon>
+            </div>
+          </el-table-column>
+          <el-table-column label="工序编码" align="center" prop="processCode" />
+          <el-table-column
+            label="工序简称"
+            align="center"
+            prop="processAlias"
+          />
+          <el-table-column
+            fixed="right"
+            label="操作"
+            align="center"
+            width="140px"
+          >
+            <template #default="scope">
+              <el-button
+                link
+                type="danger"
+                icon="Delete"
+                @click="handleDeleteProcess(scope.row)"
+                >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <!-- 分页 -->
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getTechnologicalProcessDetail"
+      />
+    </div>
+    <template #footer>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >保存</el-button
+      >
+      <el-button icon="Close" @click="handleCancel">取 消</el-button>
+    </template>
+    <!-- 工序库选择工序 -->
+    <processChoice
+      ref="processChoiceRef"
+      :multiple-selected="handleProcessSelected"
+    />
+  </el-dialog>
+</template>
+<script setup>
+import { getLastLot } from "@/api/business/lot";
+import processChoice from "./DialogProcessChoice";
+import { onMounted, ref } from "vue";
+import Sortable from "sortablejs";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleUpdateSuccess"]);
+/**工艺版本变更变量 */
+const loading = ref(false);
+let currentUID = ref(0);
+const processLoading = ref(false);
+const total = ref(0);
+const visible = ref(false);
+const detailsRow = ref({});
+const processList = ref([]);
+const referenceLotInfo = ref({});
+//校验生成批数
+const validateLotNumber = (rule, value, callback) => {
+  const min = 0;
+  if (value %1 !== 0) { // 检查是否无法解析为整数
+    callback(new Error(`当前生成批数不能是小数`));
+  } else if (value <= min) {
+    callback(new Error("当前生成批数应大于0"));
+  } else {
+    callback();
+  }
+};
+//校验单批量
+const validateproductionQuantity = (rule, value, callback) => {
+  const min = 0;
+  if (value %1 !== 0) {
+    callback(new Error(`当前单批量不能是小数`));
+  } else if (value <= min) {
+    callback(new Error("当前单批量应大于0"));
+  } else {
+    callback();
+  }
+};
+/**查询对象 */
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    referenceLot: null,
+    lotNumber: null,
+    productionQuantity: null,
+  },
+  rules: {
+    lotNumber: [
+      { required: true, message: "生成批数不能为空", trigger: "blur" },
+      { validator: validateLotNumber, trigger: "blur" },
+    ],
+    productionQuantity: [
+      { required: true, message: "单批量不能为空", trigger: "blur" },
+      { validator: validateproductionQuantity, trigger: "blur" },
+    ],
+  },
+});
+const { queryParams, form, rules } = toRefs(data);
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  reset();
+  detailsRow.value = proxy.deepClone(data[0]);
+  processList.value = [];
+  console.log(detailsRow.value);
+  visible.value = true;
+};
+//获得工艺版本列表
+function getTechnologicalProcessDetail() {
+  processLoading.value = true;
+  processLoading.value = false;
+}
+
+/** 表单重置 */
+const reset = () => {
+  form.value = {
+    id: null,
+    referenceLot: null,
+    lotNumber: null,
+    productionQuantity: null,
+  };
+  proxy.resetForm("wasteRecyclingRef");
+};
+/**生成批数变化*/
+function handleUpdateLotNumber() {
+  if (form.value.lotNumber > 0) {
+    //查询该计划单最后一个批数(排除分批的批次)
+    getLastLot({
+      productionPlanDetailId: detailsRow.value.productionPlanDetailId,
+    }).then((res) => {
+      if (res.code == 200) {
+        var lastLot = res.data.lotCode;
+        var partOne = lastLot.substring(0, 8);
+        var partTwo = lastLot.substring(8, 11);
+        //获取生成批号
+        var prefix = partTwo.replace(/[0-9]/g, "");
+        var number = parseInt(partTwo.match(/[0-9]+/)[0]);
+        var numbers = [];
+        let currentNumber = number;
+        for (let i = 0; i < form.value.lotNumber; i++) {
+          var newNumber = currentNumber + (i + 1);
+          numbers.push(
+            prefix +
+              newNumber
+                .toString()
+                .padStart(partTwo.match(/[0-9]+/)[0].length, "0")
+          );
+        }
+        var lots = [];
+        for (let i = 0; i < numbers.length; i++) {
+          lots.push(partOne + numbers[i] + "0");
+        }
+        form.value.newLots = lots;
+      }
+    });
+  }
+}
+
+/**工序删除 */
+function handleDeleteProcess(row) {
+  processList.value.splice(processList.value.indexOf(row), 1);
+}
+/** 提交按钮 */
+const handleSave = () => {
+  proxy.$refs["wasteRecyclingRef"].validate((valid) => {
+    if (valid) {
+      var wasteRecyclingInfo = {}
+      for (var i = 0; i < processList.value.length; i++) {
+        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)
+      //保存废品回用
+
+    }
+  });
+};
+
+/**参考批次带回 */
+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()
+}
+/** 行拖拽 */
+function rowDrop() {
+  // 要侦听拖拽响应的DOM对象
+  const tbody = document.querySelector('#insideProcessForm .el-table__body-wrapper tbody')
+  Sortable.create(tbody, {
+    // 指定父元素下可被拖拽的子元素
+    handle: '.move-handle',
+    // 结束拖拽后的回调函数
+    onEnd({ newIndex, oldIndex }) {
+      const currentRow = processList.value.splice(oldIndex, 1)[0]
+      processList.value.splice(newIndex, 0, currentRow)
+    }
+  })
+}
+
+/**工序库添加工序 */
+function handleAddProcess() {
+  proxy.$refs.processChoiceRef.open();
+}
+
+/**工序库添加工序带回 */
+function handleProcessSelected(selection) {
+  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.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.processKey = selection[i].processKey;
+    processAdd.productDescription = referenceLotInfo.value.productDescription
+    processAdd.uuid = currentUID++;
+    processList.value.push(processAdd);
+  }
+  console.log(processList.value);
+  rowDrop()
+}
+/** 获取行 id */
+function getRowKey(row) {
+  return row.uuid;
+}
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+  reset();
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>

+ 289 - 0
src/views/business/lot/index.vue

@@ -0,0 +1,289 @@
+<template>
+  <div class="page-container column-container">
+    <!-- 搜索区 -->
+    <el-form
+      class="list-search-container"
+      :model="queryParams"
+      ref="queryRef"
+      :inline="true"
+    >
+      <el-form-item label="产品描述:">
+        <el-input
+          placeholder="请输入产品描述"
+          v-model.trim="queryParams.productDescription"
+          style="width: 150px"
+          clearable
+          @keyup.enter="handleQuerydaywork"
+          @keydown.enter.prevent
+        />
+      </el-form-item>
+      <el-form-item label="批次号:">
+        <el-input
+          placeholder="请输入批次号"
+          v-model.trim="queryParams.lotCode"
+          style="width: 130px"
+          clearable
+          @keyup.enter="handleQuerydaywork"
+          @keydown.enter.prevent
+        />
+      </el-form-item>
+      <el-form-item label="工段:">
+        <el-select-v2
+          v-model="queryParams.deptId"
+          :options="deptList"
+          placeholder="请选择工段"
+          style="width: 140px"
+        />
+      </el-form-item>
+      <el-form-item label="是否回退:">
+        <el-select
+          v-model="queryParams.isFallback"
+          placeholder="请选择是否回退"
+        >
+          <el-option
+            v-for="item in yes_no"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="是否废品回用:">
+        <el-select
+          v-model="queryParams.isWasteRecycling"
+          placeholder="请选择是否废品回用"
+        >
+          <el-option
+            v-for="item in yes_no"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="info" icon="Search" @click="handleQuerydaywork"
+          >搜索</el-button
+        >
+      </el-form-item>
+      <div style="margin-top: 20px">
+        <el-button type="primary" @click="handleFallback">回退</el-button>
+        <el-button type="primary" @click="handleWasteRecycling" :disabled="selections.length == 0 || selections.length > 1"
+          >添加废品回用</el-button
+        >
+        <el-button type="primary" @click="handleQuerydaywork">分批</el-button>
+        <el-button type="primary" @click="handleQuerydaywork"
+          >单批单改</el-button
+        >
+        <el-button type="primary" @click="handleQuerydaywork"
+          >多批单改</el-button
+        >
+      </div>
+    </el-form>
+
+    <!-- 列表区 -->
+    <div class="el-table-container">
+      <el-table
+        ref="dayworkTable"
+        v-loading="loading"
+        row-key="id"
+        @selection-change="handleSelectionChange"
+        height="100%"
+        :data="lotList"
+      >
+        <el-table-column type="selection" width="40" align="center" />
+        <el-table-column
+          label="客户简称"
+          prop="companyAlias"
+          width="120"
+          align="center"
+        />
+        <el-table-column
+          label="生产计划单号"
+          width="100"
+          prop="productionPlanNo"
+          align="center"
+        />
+        <el-table-column
+          label="批次号"
+          prop="lotCode"
+          width="130"
+          align="center"
+        />
+        <el-table-column
+          label="产品描述"
+          prop="productDescription"
+          align="center"
+        />
+        <el-table-column
+          label="图纸版本"
+          width="80"
+          prop="technologyVersion"
+          align="center"
+        />
+        <el-table-column
+          label="投产量"
+          width="100"
+          prop="productionQuantity"
+          align="center"
+        />
+        <el-table-column
+          label="下达日期"
+          prop="createTime"
+          width="100"
+          align="center"
+        >
+          <template #default="scope">
+            <span>{{
+              proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="当前工段"
+          width="100"
+          prop="deptName"
+          align="center"
+        />
+        <el-table-column
+          label="当前工序"
+          width="120"
+          prop="processAlias"
+          align="center"
+        />
+        <el-table-column
+          label="回退"
+          width="60"
+          prop="isFallback"
+          align="center"
+        >
+          <template #default="scope">
+            <dict-tag :options="yes_no" :value="scope.row.isFallback" />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="废品回用"
+          width="70"
+          prop="isWasteRecycling"
+          align="center"
+        >
+          <template #default="scope">
+            <dict-tag :options="yes_no" :value="scope.row.isWasteRecycling" />
+          </template>
+        </el-table-column>
+        <el-table-column label="批废" width="70" prop="isWaste" align="center">
+          <template #default="scope">
+            <dict-tag :options="yes_no" :value="scope.row.isWaste" />
+          </template>
+        </el-table-column>
+        <el-table-column label="母批号" prop="fromCode" align="center" />
+      </el-table>
+    </div>
+    <!-- 分页 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getLot"
+    />
+    <waste-recycling-dialog
+      ref="wasteRecyclingDialogRef"
+    ></waste-recycling-dialog>
+  </div>
+</template>
+
+  <script setup>
+import { getDeptList } from "@/api/system/dept.js";
+import { getLotList } from "@/api/business/lot.js";
+import wasteRecyclingDialog from "./DialogWasteRecycling.vue";
+import { ref } from "vue";
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { yes_no } = proxy.useDict("yes_no");
+/** 表单抽屉 页变量 */
+const currentProductionPlan = ref({});
+const loading = ref(false);
+const lotList = ref([]);
+const total = ref(0);
+const visible = ref(false);
+const selections = ref([]);
+const deptList = ref([]);
+/** 查询对象 */
+const queryParams = ref({
+  pageNum: 1,
+  pageSize: 10,
+  lotCode: "D24326310010",
+  deptId: null,
+  isFallback: "",
+  isWasteRecycling: "",
+});
+const queryDeptParams = ref({
+  lineNumber: "",
+  productionPlanNo: "",
+});
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+function getDept() {
+  getDeptList({ type: 0, isWorkSection: 1 }).then((res) => {
+    if (res.code == 200) {
+      deptList.value = res.data;
+    }
+  });
+  //获取工段信息
+  getLot();
+  visible.value = true;
+}
+/**获取生产计划列表 */
+function getLot() {
+  loading.value = true;
+  getLotList(queryParams.value).then((res) => {
+    if (res.code == 200) {
+      lotList.value = res.rows;
+      total.value = res.total;
+      loading.value = false;
+    }
+  });
+}
+/**搜索 */
+function handleQuerydaywork() {
+  getLot();
+}
+/**打开废品回用弹窗 */
+function handleWasteRecycling() {
+  proxy.$refs.wasteRecyclingDialogRef.open(selections.value)
+}
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  visible.value = false;
+}
+
+/**搜索栏清空 */
+function reset() {
+  queryParams = ref({
+    pageNum: 1,
+    pageSize: 10,
+    lotCode: "",
+    deptId: null,
+    isFallback: "",
+    isWasteRecycling: "",
+  });
+  proxy.resetForm("queryRef");
+}
+function handleSelectionChange(selection) {
+  selections.value = selection;
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+};
+
+onMounted(() => {
+  getDept();
+});
+</script>
+  

+ 140 - 0
src/views/business/productionBatch/DialogProduction.vue

@@ -0,0 +1,140 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-dialog title="生产计划表单" v-model="visible" width="800px" append-to-body draggable>
+    <div class="form-container">
+      <el-form ref="productionFormRef" class="master-container" v-loading="loading" :model="form" label-width="100px">
+        <el-form-item label="图纸版本:" label-width="100px">
+          <el-select-v2 v-model="form.technologicalProcessId" :options="technologicalVersionList" placeholder="请选择图纸版本" style="width: 120px" @change="handleChangeTechnologicalVersion" />
+        </el-form-item>
+      </el-form>
+      <el-table
+      ref="dialogTable"
+      :data="processList"
+      row-key="id"
+      size="small"
+      v-loading="loading"
+      border
+      height="360px"
+      header-row-class-name="list-header-row"
+      row-class-name="list-row"
+    >
+      <el-table-column type="index" label="行号" width="50" align="center" />
+      <el-table-column label="工序步骤编号" width="100" align="center" prop="processStepNumber"/>
+      <el-table-column label="工序编码" align="center" prop="processCode" />
+      <el-table-column label="工序简称" align="center" prop="processAlias" />
+    </el-table>
+     <!-- 分页 -->
+     <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getTechnologicalProcessDetail" />
+    </div>
+    <template #footer>
+      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button icon="Close" @click="handleCancel">取 消</el-button>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { getTechnologicalVersion,getTechnologicalProcessDetailList,updateProductionPlanDetail } from '@/api/business/productionPlanDetail'
+import { ref } from 'vue'
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['handleUpdateSuccess'])
+/**工艺版本变更变量 */
+const loading = ref(false)
+const processLoading = ref(false)
+const total = ref(0)
+const visible = ref(false)
+const detailsRow = ref({})
+const processList = ref([])
+const technologicalVersionList = ref([])
+/**查询对西昂 */
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    technologicalProcessId:null
+  }
+})
+
+const { queryParams,form } = toRefs(data)
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  reset()
+  visible.value = true
+  detailsRow.value = proxy.deepClone(data);
+  console.log(detailsRow.value)
+  form.value.technologicalProcessId = detailsRow.value.technologicalProcessId
+  form.value.id = detailsRow.value.id
+  form.value.productionPlanDetailId = detailsRow.value.id
+  getTechnologicalVersion({productId:parseInt(detailsRow.value.productId)}).then((res)=> {
+    if(res.code == 200) {
+      technologicalVersionList.value = res.data
+      getTechnologicalProcessDetail()
+    }
+  })
+}
+// 更改工艺版本
+function handleChangeTechnologicalVersion() {
+  getTechnologicalProcessDetail()
+}
+//获得工艺版本列表
+function getTechnologicalProcessDetail() {
+  processLoading.value = true
+  queryParams.value.technologicalProcessId = form.value.technologicalProcessId
+   getTechnologicalProcessDetailList(queryParams.value).then((res) => {
+    if (res.code == 200) {
+      processList.value = res.data
+      total.value = res.total
+      processLoading.value = false
+    }
+  })
+}
+
+/** 表单重置 */
+const reset = () => {
+  form.value = {
+    id: null,
+    technologicalProcessId:null
+  }
+  proxy.resetForm('productionFormRef')
+}
+
+
+/** 提交按钮 */
+const handleSave = () => {
+  proxy.$refs['productionFormRef'].validate((valid) => {
+    if (valid) {
+      //新工艺版本
+      for(let i = 0; i < technologicalVersionList.value.length; i++) {
+        if(form.value.technologicalProcessId == technologicalVersionList.value[i].value) {
+          form.value.technologyVersion = technologicalVersionList.value[i].label
+        }
+        //旧工艺版本
+        if(detailsRow.value.technologicalProcessId == technologicalVersionList.value[i].value) {
+          form.value.oldTechnologyVersion = technologicalVersionList.value[i].label
+          form.value.oldTechnologicalProcessId = detailsRow.value.technologicalProcessId
+        }
+      }
+      updateProductionPlanDetail(form.value).then(res => {
+        if(res.code == 200) {
+          proxy.$modal.msgSuccess('修改成功')
+          emit('handleUpdateSuccess')
+          visible.value = false
+        }
+      })
+}
+  })
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false
+  reset()
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 15 - 16
src/views/business/productionBatch/index.vue

@@ -187,13 +187,13 @@
                   v-hasPermi="['business:productionBatch:add']"
                   >投产
                 </el-button>
-                <!-- <el-button
+                <el-button
                   icon="edit"
                   link
                   type="warning"
                   @click="handleUpdateProduction(scope.row)"
                   >编辑</el-button
-                > -->
+                >
               </template>
             </el-table-column>
           </el-table>
@@ -325,7 +325,8 @@
     />
     <!-- 领料信息弹窗 -->
     <check-material ref="checkMaterialRef" />
-    <!-- <production-dialog ref="productionDetailRef" @handleUpdateSuccess = "handleFresh()"/> -->
+    <!-- 工艺版本变更弹窗 -->
+    <production-dialog ref="productionDetailRef" @handleUpdateSuccess = "handleFresh()"/>
   </div>
 </template>
 <script setup name="ProductionBatch">
@@ -340,7 +341,7 @@ import {
 import { updateLotCodeStatus } from "@/api/business/productionPlanDetail.js";
 import checkMaterial from "./DialogCheckMaterial";
 import productionLotForm from "./form";
-// import productionDialog from './DialogProduction'
+import productionDialog from './DialogProduction'
 const { proxy } = getCurrentInstance();
 /** 字典数组区 */
 const { lot_code_status_code } = proxy.useDict("lot_code_status_code");
@@ -410,9 +411,6 @@ function handleFresh() {
 function getProductionPlanDetail() {
   detailLoading.value = true;
   listProductionPlanDetail(queryParams.value).then((res) => {
-    detailPlanList.value = res.rows;
-    total.value = res.total;
-    detailLoading.value = false;
     detailPlanList.value = res.rows;
     total.value = res.total;
     detailLoading.value = false;
@@ -427,10 +425,10 @@ function handleQueryProductionPlanDetail() {
   queryParams.value.pageNum = 1;
   getProductionPlanDetail();
 }
-// //修改生产计划
-// function handleUpdateProduction(row) {
-//   proxy.$refs.productionDetailRef.open(row);
-// }
+//打开修改生产计划的版本弹窗
+function handleUpdateProduction(row) {
+  proxy.$refs.productionDetailRef.open(row);
+}
 //查询生产计划单的领料信息
 function handleCheckMarterialInfo(row) {
   proxy.$refs.checkMaterialRef.open(row);
@@ -439,6 +437,7 @@ function handleCheckMarterialInfo(row) {
 function handlePlanDetailCurrentChange(row) {
   if (row) {
     currentPlanDetail.value = row;
+    //领料部门是当前工段时,有操作列进行修改删除
     if (
       currentPlanDetail.value.requisitionDepartmentId ==
       queryParams.value.deptId
@@ -474,6 +473,7 @@ function handleAddSubDetail(row) {
   //生产计划单批量
   newDetail.oneLotQuantity = row.oneLotQuantity;
   newDetail.deptId = queryParams.value.deptId;
+  //生产计划总批数
   newDetail.totalLotNumber = row.totalLotNumber;
   newDetail.technologicalProcessId = row.technologicalProcessId;
   newDetail.technologyVersion = row.technologyVersion;
@@ -515,16 +515,14 @@ function handleShowSubDetailDialog(row) {
   row.productionPlanDetailId = currentPlanDetail.value.id;
   //编辑状态
   row.status = true;
-  //修改尾批状态在row里
+ //判断已投产的生产子计划是否包含尾批
   getLastLotStatus(currentPlanDetail.value.id).then((response) => {
     if (response.code == 200) {
       //如果为true,生产子计划已有尾批
-      newDetail.lastLot = response.data;
-      proxy.$refs.productionRef.open(newDetail);
+      row.lastLot = response.data;
+      proxy.$refs.productionRef.open(row);
     }
   });
-  row.lastLot = false;
-  proxy.$refs.productionRef.open(row);
 }
 
 /** 删除子计划事件 */
@@ -537,6 +535,7 @@ function handleDelSubDetail(row) {
       return delPlanDetailSubDetail(_ids);
     })
     .then(() => {
+      //如果该生产计划没有生产子计划了,改变生产计划的批号状态
       if (subInfo.length == 0) {
         updateLotCodeStatus({
           id: currentPlanDetail.value.id,

+ 304 - 0
src/views/business/reviseBath/dayworkWasteDialog.vue

@@ -0,0 +1,304 @@
+<template>
+  <el-dialog
+    title="批废信息表单"
+    v-model="visible"
+    width="1000px"
+    append-to-body
+    draggable
+  >
+    <div class="form-container">
+      <div style="padding: 16px 16px 0 16px;">
+      <el-row :gutter="20">
+        <span style="font-weight: bold;font-size: 18px;">批次号:{{ detailInfo.lotCode }}</span>
+      </el-row>
+      <el-row :gutter="20" style="margin-top:15px;">
+       <span style="font-weight: bold;">基础信息</span>
+      </el-row>
+      <el-row :gutter="20" style="margin-top: 15px;padding-bottom: 10px; border-bottom: 1px solid #999;">
+        <el-col :span="11">
+          <span class="leftInfo">客户简称</span>
+          <span class="rightInfo">{{ detailInfo.companyAlias }}</span>
+        </el-col>
+        <el-col :span="6">
+          <span class="middleInfo">生产计划单号</span>
+          <span class="rightInfo">{{ detailInfo.productionPlanNo }}</span>
+        </el-col>
+        <el-col :span="7">
+          <span class="middleInfo">批次号</span>
+          <span class="rightInfo">{{ detailInfo.lotCode }}</span>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20" style="margin-top: 15px; padding-bottom: 10px;border-bottom: 1px solid #999;">
+        <el-col :span="11" >
+          <span class="leftInfo">产品描述</span>
+          <span class="rightInfo" >{{ detailInfo.productDescription }}</span>
+        
+        </el-col>
+        <el-col :span="6">
+          <span class="middleInfo">图纸版本</span>
+          <span class="rightInfo">{{ detailInfo.technologyVersion }}</span>
+        </el-col>
+        <el-col :span="7">
+          <span class="middleInfo">批次投产量</span>
+          <span class="rightInfo">{{ detailInfo.productionQuantity }}</span>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20" style="margin-top: 15px; padding-bottom: 10px;border-bottom: 1px solid #999;">
+        <el-col :span="11">
+          <span class="leftInfo">下达日期</span>
+          <span class="rightInfo">{{ detailInfo.createTime }}</span>
+        </el-col>
+        <el-col :span="6">
+          <span class="middleInfo">当前工段</span>
+          <span class="rightInfo">{{ detailInfo.deptName }}</span>
+        </el-col>
+        <el-col :span="7">
+          <span class="middleInfo">当前工序投产量</span>
+          <span class="rightInfo">{{ detailInfo.temporaryProcessQualifiedNum == 0?detailInfo.productionQuantity:detailInfo.temporaryProcessQualifiedNum }}</span>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20" style="margin-top:20px;margin-bottom: 20px;">
+       <span style="font-weight: bold;">批废信息</span>
+      </el-row>
+      </div>
+      <el-form
+        ref="lotWasteRef"
+        v-loading="loading"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        label-width="80px"
+      >
+      <el-row :gutter="20">
+        <el-col :span="8">
+        <el-form-item label="责任工段" label-width="80px" prop="deptId">
+          <el-select-v2
+              v-model="form.deptId"
+              :options="deptList"
+              placeholder="请选择工段"
+              :disabled="editStatus"
+              @change="getProcess"
+              style="width: 140px"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="9">
+        <el-form-item label="责任工序" label-width="100px" prop="technologicalProcessId">
+          <el-select-v2
+              v-model="form.technologicalProcessId"
+              :options="processList"
+              placeholder="请选择工序"
+              :disabled="editStatus||form.deptId==null"
+              style="width: 140px"
+          >
+          <template #default="{ index,item }">
+            <span style="float: left;">{{ index +1 }}</span>
+      <span style="margin-left: 8px;">{{ item.label }}</span>
+    </template>
+  </el-select-v2>
+        </el-form-item>
+      </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-form-item label="批废原因" label-width="90px" prop="reason">
+          <el-input type="textarea" 
+            placeholder="请输入批废原因"
+            :disabled="editStatus"
+            v-model.trim="form.reason"
+            style="width: 495px;"
+          />
+        </el-form-item>
+      </el-row>
+      <el-row :gutter="20">
+         <el-col :span="8">
+          <el-form-item label="填写人" label-width="80px" prop="fillName">
+          <el-input 
+            :disabled="true"
+            placeholder="请输入填写人"
+            v-model.trim="form.fillName"
+            style="width: 140px;"
+          />
+        </el-form-item>
+         </el-col>
+         <el-col :span="9">
+          <el-form-item label="填写时间" label-width="100px" prop="fillDate">
+            <el-date-picker
+                v-model="form.fillDate"
+                :disabled="true"
+                type="date"
+                value-format="YYYY-MM-DD"
+                placeholder="请选择填写时间"
+                style="width: 150px"
+              />
+        </el-form-item>
+         </el-col>
+      </el-row>
+      </el-form>
+    </div>
+    <template #footer>
+      <template v-if="!editStatus">
+      <el-button  type="primary" icon="Check" @click="handleSave"
+        >保存</el-button
+      >
+      <el-button icon="Close" @click="handleCancel">取 消</el-button>
+    </template>
+      <template v-else>
+      <el-button  type="warning" icon="Edit" @click="handleEdit"
+        >编辑</el-button
+      >
+      <el-button type="danger" icon="Delete" @click="handleDeleteLotWaste"
+        >取消废弃</el-button
+      >
+    </template>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { selectDeptInfo } from "@/api/system/dept";
+import {
+  getDayworkProcessList
+} from "@/api/business/daywork.js";
+import {addLotWaste,updateLotWaste,delLotWaste} from "@/api/business/lotWaste.js";
+import useUserStore from '@/store/modules/user'
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典数组区 */
+const { is_allow_more } = proxy.useDict("is_allow_more");
+/** 废批*/
+const deptList = ref([]);
+const detailInfo = ref({})
+const processList = ref([]);
+const loading = ref(false);
+const editStatus = ref(true)
+const visible = ref(false);
+const data = reactive({
+  form: {},
+  rules: {
+    deptId: [
+      { required: true, message: "责任工段不能为空", trigger: "blur" }],
+      technologicalProcessId: [
+      { required: true, message: "责任工序不能为空", trigger: "blur" }],
+  },
+});
+const { form, rules } = toRefs(data);
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (row) => {
+  reset();
+  detailInfo.value = proxy.deepClone(row)
+  editStatus.value = row.flag
+  console.log(row)
+  //查工段
+    selectDeptInfo({dayworkId:row.id}).then(res => {
+      deptList.value = res.data
+    })
+
+  if(row.isWaste == 0) {
+  form.value.fillDate = proxy.moment().format("YYYY-MM-DD")
+  form.value.fillName = useUserStore().user.nickNames
+  }else {
+    form.value = detailInfo.value.lotWaste
+  }
+  form.value.lotId = row.lotId
+  visible.value = true;
+}
+//获得工序
+function getProcess() {
+  form.value.technologicalProcessId = null
+  getDayworkProcessList({id:detailInfo.value.id,deptId:form.value.deptId}).then(response => {
+      processList.value = response.data
+    })
+}
+/** 取消按钮 */
+function handleCancel() {
+  visible.value = false;
+  reset();
+}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    id: null,
+    technologicalProcessId: null,
+    reason: "",
+    deptId: null,
+    fillDate: null,
+    fillName:null,
+    lotId:""
+  };
+  proxy.resetForm("lotWasteRef");
+}
+
+/** 提交按钮 */
+function handleSave() {
+  proxy.$refs["lotWasteRef"].validate((valid) => {
+    if (valid) {
+      //添加
+      if(detailInfo.value.isWaste == 0) {
+        addLotWaste(form.value).then(res => {
+          if(res.code == 200) {
+            proxy.$message({
+              type: "success",
+              message: "批废成功"
+            });
+            emit("handleSaveSuccess");
+            handleCancel();
+          }
+        })
+      }else {
+        updateLotWaste(form.value).then(response => {
+          if(response.code == 200) {
+            proxy.$message({
+              type: "success",
+              message: "修改成功"
+            });
+            emit("handleSaveSuccess");
+            handleCancel();
+          }
+        })
+      }
+    }
+  })
+}
+//取消废弃
+function handleDeleteLotWaste() {
+  proxy.$modal
+    .confirm("是否确认取消废批?")
+    .then(function () {
+      return delLotWaste(form.value.id);
+    })
+    .then(() => {
+      emit("handleSaveSuccess");
+      proxy.$modal.msgSuccess("删除成功!");
+      handleCancel();
+    });
+}
+function handleEdit() {
+  editStatus.value = false
+}
+
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+});
+</script>
+<style scoped>
+.leftInfo {
+  color: #999;
+  font-size: 16px;
+  width: 120px;
+/* display: inline-block; */
+}
+.middleInfo {
+  color: #999;
+  font-size: 16px;
+  width: 120px;
+display: inline-block;
+}
+.rightInfo {
+    font-size: 16px;
+    padding-left: 20px;
+}
+</style>

+ 11 - 8
src/views/business/reviseBath/index.vue

@@ -26,7 +26,7 @@
     <!-- 列表区 -->
     <div class="el-table-container">
       <div class="el-table-inner-container">
-        <el-table v-loading="loading" :data="productionPlanList" height="100%">
+        <el-table v-loading="loading" :data="productionPlanList" height="100%" >
           <el-table-column
             type="index"
             label="行号"
@@ -157,17 +157,15 @@
       v-model:limit="queryParams.pageSize"
       @pagination="getList"
     />
-       <!-- 产品批次详情 -->
-       <daywork-form
-      ref="dayworkFormRef"
-    />
+    <!-- 已经生产的批次 -->
+    <produced-lot ref="producedLotFormRef"></produced-lot>
   </div>
 </template>
 
 <script setup name="ProductionPlan">
 import { getP2Plan } from "@/api/business/p2.js";
 import { listProductionPlanDetail } from "@/api/business/productionPlanDetail.js";
-import dayworkForm from "./form.vue";
+import producedLot from "./producedLotForm.vue";
 import { ref } from "vue";
 const { proxy } = getCurrentInstance();
 /** 字典数组区 */
@@ -203,10 +201,10 @@ function getList() {
     queryParams.value.pullP2PlanDetails = false;
   });
 }
-
 /** 查看按钮操作 */
 function handleView(row) {
-  proxy.$refs.dayworkFormRef.open(row);
+  proxy.$refs.producedLotFormRef.open(row)
+  
 }
 
 /** 搜索按钮操作 */
@@ -225,6 +223,11 @@ const handleSyncP2Plan = () => {
 </script>
 
 <style lang="scss" scoped>
+.hyperlink {
+  color: blue;
+  text-decoration: underline;
+  cursor: pointer;
+}
 .dashboard-total-item {
   display: flex;
   align-items: center;

+ 218 - 0
src/views/business/reviseBath/producedLotForm.vue

@@ -0,0 +1,218 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-drawer
+      v-model="visible"
+      size="90%"
+      direction="rtl"
+      :close-on-press-escape="false"
+  >
+    <div class="page-container form-container">
+      <div class="form-btns-container" style="display: flex; align-items: center;">
+        <span class="title-label" 
+        ><el-icon>
+            <Document/>
+          </el-icon>
+          计划详情</span
+        >
+      </div>
+      <!-- 主表 -->
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
+        <el-form-item label="产品描述:">
+          <el-input
+            placeholder="请输入产品描述"
+            v-model.trim="queryParams.productDescription"
+            style="width: 150px"
+            clearable
+            @keyup.enter="handleQuerydaywork"
+            @keydown.enter.prevent
+          />
+        </el-form-item>
+        <el-form-item label="批次号:">
+          <el-input
+            placeholder="请输入批次号"
+            v-model.trim="queryParams.lotCode"
+            style="width: 130px"
+            clearable
+            @keyup.enter="handleQuerydaywork"
+            @keydown.enter.prevent
+          />
+        </el-form-item>
+        <el-form-item label="工段:">
+          <el-select-v2
+              v-model="queryParams.deptId"
+              :options="deptList"
+              placeholder="请选择工段"
+              style="width: 140px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="info" icon="Search" @click="handleQuerydaywork"
+            >搜索</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <!-- 列表区 -->
+      <div class="el-table-container">
+        <el-table
+            ref="dayworkTable"
+            v-loading="loading"
+            row-key="id"
+            height="100%"
+            :data="lotList"
+        >
+        <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+          <el-table-column label="客户简称" prop="companyAlias" align="center"/>
+          <el-table-column label="生产计划单号" width="100" prop="productionPlanNo" align="center"/>
+          <el-table-column label="批次号" prop="lotCode" align="center">
+            <template #default="{ row }">
+          <a href="#" class="hyperlink" @click="handleColumnClick(row)">
+            {{ row.lotCode }}
+          </a>
+        </template>
+          </el-table-column>
+          <el-table-column label="产品描述" prop="productDescription" align="center"/>
+          <el-table-column label="图纸版本" width="80" prop="technologyVersion" align="center"/>
+          <el-table-column label="投产量" width="100" prop="productionQuantity" align="center"/>
+          <el-table-column
+                label="下达日期"
+                prop="createTime"
+                width="100"
+                align="center"
+            >
+              <template #default="scope">
+                <span>{{
+                    proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+                  }}</span>
+              </template>
+            </el-table-column>
+          <el-table-column label="当前工段" width="100" prop="deptName" align="center"/>
+          <el-table-column label="当前工序" width="120" prop="processAlias" align="center"/>
+          <el-table-column label="废品回用" width="70" prop="isWasteRecycling" align="center">
+            <template #default="scope">
+              <dict-tag
+                  :options="yes_no"
+                  :value="scope.row.isWasteRecycling"
+              />
+            </template>
+          </el-table-column>
+          <el-table-column label="批废" width="70" prop="isWaste" align="center">
+            <template #default="scope">
+              <dict-tag
+                  :options="yes_no"
+                  :value="scope.row.isWaste"
+              />
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+  </el-drawer>
+</template>
+<script setup>
+import {
+  getProducedLot,getDeptList
+} from "@/api/business/daywork.js";
+const {proxy} = getCurrentInstance();
+/** 字典数组区 */
+const { yes_no } = proxy.useDict("yes_no");
+/** 表单抽屉 页变量 */
+const currentProductionPlan = ref({});
+const loading = ref(false);
+const lotList = ref([])
+const visible = ref(false);
+const deptList = ref([])
+/** 查询对象 */
+const queryParams = ref({
+  pageNum: 1,
+  pageSize: 10,
+  lotCode: "",
+  deptId: null,
+});
+const queryDeptParams = ref({
+  lineNumber:'',
+  productionPlanNo:''
+})
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (row) => {
+  reset()
+  currentProductionPlan.value = row;
+  queryParams.value.lineNumber = row.lineNumber
+  queryParams.value.productionPlanNo = row.productionPlanNo
+  queryDeptParams.value.lineNumber = row.lineNumber
+  queryDeptParams.value.productionPlanNo = row.productionPlanNo
+  getDeptList(queryDeptParams.value).then(res => {
+    if(res.code == 200) {
+        deptList.value = res.data
+    }
+  })
+  //获取工段信息
+  getProducedLotList()
+  visible.value = true;
+};
+/** 打开批次详情页 */
+function handleColumnClick(row) {
+
+}
+/**获取生产计划列表 */
+function getProducedLotList() {
+  loading.value = true;
+  getProducedLot(queryParams.value).then(res => {
+    if(res.code == 200) {
+      lotList.value = res.rows
+      loading.value = false
+    }
+  })
+}
+/**搜索 */
+function handleQuerydaywork() {
+  getProducedLotList()
+}
+/**查看 */
+function handleChecklot(row) {
+}
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  visible.value = false;
+}
+
+/**搜索栏清空 */
+function reset() {
+  queryParams.value.pageNum = 1;
+  queryParams.value.pageSize = 10;
+  queryParams.value.lotCode = null;
+  queryParams.value.deptId = null;
+
+  proxy.resetForm("queryRef");
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>
+<style scoped>
+.hyperlink {
+  color: blue;
+  text-decoration: underline;
+  cursor: pointer;
+}
+</style>

+ 2 - 1
src/views/dialog/equipment.vue

@@ -15,7 +15,7 @@
       </el-form-item>
     </el-form>
     <div class="page-container column-container">
-      <el-table ref="dialogTable" :data="list" height="440px" row-key="id" @selection-change="handleSelectionChange" align="center">
+      <el-table ref="dialogTable" :data="list" height="460px" row-key="id" @selection-change="handleSelectionChange" align="center">
         <el-table-column v-if="multiple" type="selection" width="40" :reserve-selection="true" :selectable="selectable" align="center" />
         <el-table-column label="行号" type="index" width="50" align="center" />
         <el-table-column label="设备编码" prop="equipmentCode" align="center" />
@@ -103,6 +103,7 @@ function open(row) {
 function close() {
   proxy.$refs.dialogForm.resetFields()
   proxy.$refs.dialogTable.clearSelection()
+  handleSearch('clear')
   visible.value = false
 }