zck 1 hafta önce
ebeveyn
işleme
7cfe28616a
1 değiştirilmiş dosya ile 230 ekleme ve 12 silme
  1. 230 12
      src/view/yunyin/shengchanguanli/dahuobaobiao.vue

+ 230 - 12
src/view/yunyin/shengchanguanli/dahuobaobiao.vue

@@ -2,14 +2,10 @@
   <div>
     <layout>
       <layout-header>
-        <div class="top-action-bar">
-          <el-button type="primary" @click="exportMonthlyData" style="margin: 5px">
-            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" style="margin-right: 5px">
-              <path d="M8.5 16a.5.5 0 0 1-.5-.5V1H5a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2h-3.5v14.5a.5.5 0 0 1-.5.5z"/>
-              <path d="M7 14.5V6H2a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2H9v8.5a1.5 1.5 0 0 1-3 0z"/>
-            </svg>
-            导出出货大货生产进度表
-          </el-button>
+        <div class="top-action-bar action-buttons">
+           <el-button type="primary" icon="download" @click="exportMonthlyData">导出出货大货生产进度表</el-button>
+           <el-button type="primary" icon="edit" @click="openSampleApprovalDialog">样衣核批</el-button>
+           <el-button type="primary" icon="edit" @click="openFabricPlanDialog" :disabled="selectedRows.length !== 1">面料计划入库时间维护</el-button>
         </div>
       </layout-header>
 
@@ -27,13 +23,15 @@
           <el-main>
             <div class="gva-table-box">
               <!-- 表格数据 -->
-              <el-table ref="multipleTable" style="width: 100%; height: 65vh" tooltip-effect="dark"
+              <el-table ref="multipleTable" style="width: 100%; height: 40vh" tooltip-effect="dark",
                         :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
                         :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                         :data="tableData" border row-key="ID"
                         size="small"
                         highlight-current-row="true"
-                        @row-click="tableRowClick" :show-overflow-tooltip="true">
+                        @row-click="tableRowClick" @selection-change="handleSelectionChange" :show-overflow-tooltip="true">
+                <el-table-column type="selection" width="40" fixed="left" />
+
                 <el-table-column sortable align="center" label="款式" prop="款式" width="120" />
                 <el-table-column sortable align="center" label="客人编号" prop="客人编号" width="100" />
                 <el-table-column sortable align="center" label="下单日期" prop="下单日期" width="100" />
@@ -46,7 +44,7 @@
                 <el-table-column sortable align="center" label="入库数量" prop="入库数量" width="100" />
                 <el-table-column sortable align="center" label="面料入库时间" prop="面料入库时间" width="140" />
                 <el-table-column sortable align="center" label="辅料入库时间" prop="辅料入库时间" width="140" />
-                <el-table-column sortable align="center" label="产前样批核" prop="产前样批核" width="120" />
+                <el-table-column sortable align="center" label="产前样批核" prop="核批日期" width="120" />
                 <el-table-column sortable align="center" label="开裁日期" prop="开裁日期" width="100" />
                 <el-table-column sortable align="center" label="上车位日期" prop="上车位日期" width="120" />
                 <el-table-column sortable align="center" label="台产" prop="台产" width="80" />
@@ -61,11 +59,80 @@
                                :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
               </div>
             </div>
+            
+            <!-- 下方BOM表格 -->
+            <div class="gva-table-box" >
+              <h3 style="margin: 10px 0;">订单开工详情</h3>
+              <el-table ref="bomTable" style="width: 100%; height: 30vh" tooltip-effect="dark"
+                        :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
+                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                        :data="bomData" border
+                        size="small"
+                        :show-overflow-tooltip="true">
+                <el-table-column prop="物料名称" label="物料名称" width="200" />
+                <el-table-column prop="核批日期" label="核批日期" width="110" />
+                <el-table-column prop="核批人" label="核批人" width="130" />
+                <el-table-column prop="计划入库时间" label="计划入库时间" width="130" />
+                <el-table-column prop="实际入库时间" label="实际入库时间" width="130" />
+                <el-table-column prop="入库数量" label="入库数量" width="100" />
+                <el-table-column prop="计划入库操作人" label="计划入库操作人" width="130" />
+              </el-table>
+            </div>
           </el-main>
         </layout-content>
       </layout>
     </layout>
   </div>
+
+  <!-- 样衣核批弹窗 -->
+  <el-dialog v-model="sampleApprovalDialogVisible" title="样衣核批" width="400px" top="20%" destroy-on-close>
+    <el-form :model="sampleApprovalForm" label-width="100px">
+      <el-form-item label="核批日期">
+        <el-date-picker v-model="sampleApprovalForm.approvalDate" type="date" style="width: 100%" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="sampleApprovalDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="submitSampleApproval">确定</el-button>
+      </div>
+    </template>
+  </el-dialog>
+
+  <!-- 面料计划入库时间维护弹窗 -->
+  <el-dialog v-model="fabricPlanDialogVisible" title="面料计划入库时间维护" width="80%" top="10%" destroy-on-close>
+    <el-descriptions class="margin-top" :column="4" :size="'small'" border>
+      <el-descriptions-item label="订单编号">{{ selectedOrder?.订单编号 || '' }}</el-descriptions-item>
+      <el-descriptions-item label="客户">{{ selectedOrder?.客人编号 || '' }}</el-descriptions-item>
+      <el-descriptions-item label="款号">{{ selectedOrder?.款号 || '' }}</el-descriptions-item>
+      <el-descriptions-item label="款式">{{ selectedOrder?.款式 || '' }}</el-descriptions-item>
+    </el-descriptions>
+    <el-divider content-position="left">
+      <span style="font-size: 16px;font-weight: bold;margin-left: 20px;">面料计划入库时间(仅计划入库时间可修改)</span>
+    </el-divider>
+    <div style="margin-top: 10px;">
+      <el-table ref="fabricPlanTable" style="width: 100%;" border :data="fabricPlanData">
+        <el-table-column prop="物料分类" label="物料分类" width="120" />
+        <el-table-column prop="物料名称" label="物料名称" width="200" />
+        <el-table-column prop="计划入库时间" label="计划入库时间" width="180">
+          <template #default="{ row }">
+            <el-date-picker v-model="row.计划入库时间" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
+          </template>
+        </el-table-column>
+        <el-table-column prop="计划用料" label="计划用料" width="100" />
+        <el-table-column prop="定额用料" label="定额用料" width="100" />
+        <el-table-column prop="计划门幅" label="计划门幅" width="100" />
+        <el-table-column prop="定额门幅" label="定额门幅" width="100" />
+        <el-table-column prop="备注" label="备注" width="200" />
+      </el-table>
+    </div>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="fabricPlanDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="submitFabricPlan">保存</el-button>
+      </div>
+    </template>
+  </el-dialog>
 </template>
   <script setup>
   import {ref, reactive, onMounted} from 'vue'
@@ -73,6 +140,9 @@
   import {
     getWorkOrderDates, getWorkOrdersByMonth,
   } from '@/api/mes/job'
+  import {
+    orderBomList, FabricEdit,Approval
+  } from '@/api/mes/job'
 
   import { ElMessage } from 'element-plus'
   import { useUserStore } from '@/pinia/modules/user'
@@ -82,6 +152,7 @@
   const _username = ref('')
   _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
   
+  
   // 左侧树形数据
   const treeData = ref([])
   const defaultProps = {
@@ -97,6 +168,12 @@
   // 选中的日期
   const selectedDate = ref('')
   
+  // 选中的行
+  const selectedRows = ref([])
+  
+  // BOM数据
+  const bomData = ref([])
+  
   // 获取日期列表
   const getDateList = async () => {
     try {
@@ -210,8 +287,27 @@
   }
   
   // 表格行点击
-  const tableRowClick = (row) => {
+  const tableRowClick = async (row) => {
     console.log('点击行:', row);
+    selectedOrder.value = row;
+    
+    try {
+      // 获取BOM数据
+      const orderBomListdata = await orderBomList({ order: row.订单编号 });
+      if (orderBomListdata.code === 0) {
+        bomData.value = orderBomListdata.data;
+      } else {
+        ElMessage.error('获取BOM数据失败');
+      }
+    } catch (error) {
+      console.error('获取BOM数据失败:', error);
+      ElMessage.error('获取BOM数据失败');
+    }
+  }
+  
+  // 处理表格选择变化
+  const handleSelectionChange = (selection) => {
+    selectedRows.value = selection;
   }
   
   // 分页处理
@@ -224,6 +320,128 @@
     page.value = 1;
   }
   
+  // 样衣核批相关
+  const sampleApprovalDialogVisible = ref(false);
+  const sampleApprovalForm = reactive({
+    approvalDate: new Date() // 默认当日
+  });
+  
+  const openSampleApprovalDialog = () => {
+    if (selectedRows.value.length === 0) {
+      ElMessage.warning('请先选择数据');
+      return;
+    }
+    sampleApprovalDialogVisible.value = true;
+  };
+  
+  const submitSampleApproval = async () => {
+    try {
+      // 构建参数
+      const uniqids = selectedRows.value.map(row => row.Uniqid).join(',');
+      const approvalDate = sampleApprovalForm.approvalDate;
+      // 格式化日期,去掉时区信息
+      const formattedDate = approvalDate.toISOString().split('T')[0];
+      const operator = userStore.userInfo.nickName;
+      
+      // 接口调用逻辑,暂时留个口子
+      // console.log('样衣核批提交:', {
+      //   Uniqid: uniqids,
+      //   rq: formattedDate,
+      //   sys_id: operator
+      // });
+      const response = await Approval({ Uniqid: uniqids, rq: formattedDate, sys_id: operator });
+      if (response.code === 0) {
+        ElMessage.success('样衣核批提交成功');
+        sampleApprovalDialogVisible.value = false;
+      } else {
+        ElMessage.error('样衣核批提交失败');
+      }
+    } catch (error) {
+      console.error('样衣核批提交失败:', error);
+      ElMessage.error('样衣核批提交失败');
+    }
+  };
+  
+  // 面料计划入库时间维护相关
+  const fabricPlanDialogVisible = ref(false);
+  const selectedOrder = ref({});
+  const fabricPlanData = ref([]);
+  
+  // 获取今天的日期,格式为 YYYY-MM-DD
+  const getTodayYmd = () => {
+    const today = new Date();
+    const year = today.getFullYear();
+    const month = String(today.getMonth() + 1).padStart(2, '0');
+    const day = String(today.getDate()).padStart(2, '0');
+    return `${year}-${month}-${day}`;
+  };
+  
+
+  
+  const openFabricPlanDialog = async () => {
+    try {
+      // 使用选中的行数据
+      const selectedRow = selectedRows.value[0];
+      selectedOrder.value = selectedRow;
+      
+      // 获取BOM数据
+      const orderBomListdata = await orderBomList({ order: selectedRow.订单编号 });
+      if (orderBomListdata.code === 0) {
+        fabricPlanData.value = orderBomListdata.data;
+      } else {
+        ElMessage.error('获取BOM数据失败');
+        return;
+      }
+    } catch (error) {
+      console.error('获取BOM数据失败:', error);
+      ElMessage.error('获取BOM数据失败');
+      return;
+    }
+    
+    fabricPlanDialogVisible.value = true;
+  };
+  
+  const submitFabricPlan = async () => {
+    try {
+      const formattedData = fabricPlanData.value
+        .filter(item => item.物料名称 !== null && item.物料名称 !== "")
+        .map(item => {
+          return {
+            BOM_工单编号: selectedOrder.value.订单编号,
+            UNIQID: item.UNIQID !== undefined ? item.UNIQID : "",
+            物料分类: item.物料分类 !== null ? item.物料分类 : "",
+            BOM_物料名称: item.物料名称 !== null ? item.物料名称 : "",
+            BOM_计划用量: item.计划用料 !== null ? item.计划用料 : "",
+            BOM_标准用量: item.定额用料 !== null ? item.定额用料 : "",
+            BOM_实际用量: item.裁床实际用料 !== null ? item.裁床实际用料 : "",
+            Bom_领用数量: item.裁床领用面料 !== null ? item.裁床领用面料 : "",
+            BOM_退还数量: item.裁床退回仓库面料 !== null ? item.裁床退回仓库面料 : "",
+            BOM_desc: item.备注 !== null ? item.备注 : "",
+            BOM_计划门幅: item.计划门幅 !== null ? item.计划门幅 : "",
+            BOM_定额门幅: item.定额门幅 !== null ? item.定额门幅 : "",
+            BOM_投料单位: "",
+            Sys_ID: userStore.userInfo.nickName,
+            Sys_rq: getTodayYmd(),
+            计划入库时间: item['计划入库时间'] != null && String(item['计划入库时间']).trim() !== ''
+              ? String(item['计划入库时间']).trim()
+              : getTodayYmd(),
+            计划入库操作人: userStore.userInfo.nickName,
+          };
+        });
+      
+      const add_FabricEditdata = await FabricEdit(formattedData);
+      if (add_FabricEditdata.code === 0) {
+        ElMessage.success('保存成功');
+        fabricPlanDialogVisible.value = false;
+      } else {
+        ElMessage.error('保存失败');
+      }
+    } catch (error) {
+      console.error('保存失败:', error);
+      ElMessage.error('保存失败');
+    }
+  };
+  
   // 生命周期
   onMounted(() => {
     getDateList();