浏览代码

机台报工

liuhairui 1 年之前
父节点
当前提交
79f38b7a8c
共有 1 个文件被更改,包括 70 次插入22 次删除
  1. 70 22
      src/view/performance/chejianbaogong.vue

+ 70 - 22
src/view/performance/chejianbaogong.vue

@@ -130,7 +130,6 @@
 
                         <el-tab-pane label="班组人员及分配比例" @click="showTable('工艺资料')" name="second">
                           <el-table ref="multipleTable"
-                                    highlight-current-row="true"
                                     :show-overflow-tooltip="true"
                                     :row-style="{ height: '20px' }"
                                     :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
@@ -1859,6 +1858,10 @@ import {
   getCompanyList
 } from '@/api/company'
 
+import {
+  EquipmentSchedulingEdit,
+} from "@/api/yunyin/yunying";
+
 import {
   ProcessInspectionRecordsItemAdd,
   AdditionalInspectionRecordAdd,
@@ -2077,6 +2080,7 @@ const FacilityProduction = async () => {
 		formData.value.班组Id=response.data.班组Id
 		formData.value.machine=JTMC
 		formData.value.状态=response.data.状态
+    formData.value.定额代号=response.data.定额代号
 		BZMC.value=response.data.班组编号
 	       // 填充sczl_bh和sczl_name字段
 		   let sczl_bhkey=''
@@ -2191,6 +2195,12 @@ const FacilityDetail = async () => {
   formData.value.production_all=0
   const response = await facilityDetail({ machine: JTMC, Gd_gdbh: formData.value.工单编号, team:BZMC.value });
   if (response.code === 0) {
+    if(response.data === null){
+      formData.value.上机时间=currentDate+'08:30:00'
+    }else{
+      formData.value.上机时间=currentDate.split('')[0]+'-'+response.data[0]['生产时间段'].split('>')[1]+' 00'
+    }
+    console.log(formData.value.上机时间)
     CLMXData.splice(0, CLMXData.length, ...Object.values(response.data));
 	formData.value.production_now=response.data[0].产量
 	formData.value.production_all=response.data.total.产量
@@ -2501,22 +2511,26 @@ const RemodelGetTab = async() => {
   const response = await remodelGetTab()
   let arr=[]
   if (response.code === 0) {
-	  for(let key in response.data){
-		  if(response.data[key][0]){
-			  let children =[]
-			  for (let i = 0; i < response.data[key].length; i++) {
-				  children.push({label:response.data[key][i],machine:key})
-			  }
-			  arr.push({
-				  label:key,
-				  children:children
-			  })
-			  console.log(response.data[key].length)
-		  }else{
-			 arr.push({label:key})
-		  }
-	  }
-	  huanxingtreeData.value=arr
+	  // for(let key in response.data){
+		//   if(response.data[key][0]){
+		// 	  let children =[]
+		// 	  for (let i = 0; i < response.data[key].length; i++) {
+		// 		  children.push({label:response.data[key][i],machine:key})
+		// 	  }
+		// 	  arr.push({
+		// 		  label:key,
+		// 		  children:children
+		// 	  })
+		// 	  console.log(response.data[key].length)
+		//   }else{
+		// 	 arr.push({label:key})
+		//   }
+	  // }
+	  // huanxingtreeData.value=arr
+    huanxingtreeData.value=[{label:JTMC,children:response.data[JTMC].map(item=>({
+        label:item,
+        machine:JTMC
+      }))}]
   }
 }
 //设置机台状态
@@ -2787,8 +2801,21 @@ function onchanliang() {
 	 console.log(JTMC.split("#")[0]); // 通过value属性获取ref对象的值,然后再调用split方法
 	ReportInfo()
 }
+
+// 获取当前日期
+const today = new Date();
+const year = today.getFullYear();
+const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
+const day = String(today.getDate()).padStart(2, '0');
+const hours = String(today.getHours()).padStart(2, '0');
+const minutes = String(today.getMinutes()).padStart(2, '0');
+const seconds = String(today.getSeconds()).padStart(2, '0');
+const currentDate = `${year}-${month}-${day}`;
+const currentTime = `${year}-${month}-${day} ${hours}:${minutes}`;
+const currenttime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 //日产量详情获取
 const ReportInfo = async () => {
+
   const response = await reportInfo({ machine: JTMC.split("#")[0] });
   if (response.code === 0) {
     const { order_info, class: classInfo } = response.data;
@@ -2800,6 +2827,11 @@ const ReportInfo = async () => {
       product_name: order_info.product_name,
       yj_name: order_info.yj_name,
       gy_name: order_info.gy_name,
+      日期:currentDate,
+      下机时间:currenttime,
+      上机时间:formData.value.上机时间,
+      装版总时长:0,
+      定额代号:formData.value.定额代号,
       sczl_jtbh: classInfo.sczl_jtbh.split('#')[0],
       sczl_bzdh: classInfo.sczl_bzdh,
       sys_id: classInfo.sys_id,
@@ -3133,10 +3165,10 @@ const FacilityTeam = async (value) => {
     const updatedData = response.data.map(item => {
       return { ...item, JTMC: value }; // 添加 JTMC 属性
     });
-
+    FPData.splice(0, FPData.length, ...updatedData)
     // 将更新后的数据添加到 bzData 数组
     bzData.push(...updatedData);
-	FPData.push(...updatedData)
+	// FPData.push(...updatedData)
 	console.log(FPData)
   }
 };
@@ -3499,15 +3531,31 @@ const setMachineTeams = async(row) => {
 			team_id:formData.value.班组Id
 			})
     if (res.code === 0) {
-		FacilityProduction()
-
-		ElMessage({
+      EquipmentSchedulingEdits(row)
+      ElMessage({
 		        type: 'success',
 		        message: '成功'
 		    })
     }
 }
 
+const EquipmentSchedulingEdits = async(row) => {
+  console.log(row)
+  const res = await EquipmentSchedulingEdit([{
+    capacity:row.工序产能,
+    ProductionHours:row.计划工时,
+    AuxiliaryHours:row.装版时数,
+    shift:row.班组,
+    remark:row.排产备注,
+    start:row.最早开工时间,
+    projectTime:currentTime,
+    UniqId:row.UniqId
+  }])
+  if (res.code === 0) {
+    FacilityProduction()
+  }
+}
+
 // 删除行
 const deleteCompanyFunc = async (row) => {
     const res = await deleteCompany({ ID: row.ID })