zck 5 months ago
parent
commit
15be421623

File diff suppressed because it is too large
+ 4 - 1224
src/view/job/processSheet/BoxprocessSheet.vue


+ 88 - 0
src/view/performance/12-orderAccounting/componets/xzgdtl.vue

@@ -17,6 +17,18 @@
       @click="handleSearch"
     >定位</el-button>
 
+    <el-button
+      type="success"
+      style="width:80px; height: 40px;margin-bottom: 20px"
+      @click="handlecreate"
+    >新增</el-button>
+
+    <el-button
+      type="primary"
+      style="width:80px; height: 40px;margin-bottom: 20px"
+      @click="oncreate"
+    >保存</el-button>
+
     <el-button
       type="primary"
       style="width:80px; height: 40px;margin-bottom: 20px"
@@ -150,6 +162,24 @@ const updateOrderFeed = (data) => {
     data
   })
 }
+
+// 新增工单实际投料
+const feedAdd = (data) => {
+  return service({
+    url: '/mes_server/order_super_loss/feedAdd',
+    method: 'post',
+    data
+  })
+}
+
+// 获取新增投料物料信息
+const getFeedList = (params) => {
+  return service({
+    url: '/mes_server/order_super_loss/getFeedList',
+    method: 'get',
+    params
+  })
+}
 </script>
 
 <script setup>
@@ -242,6 +272,64 @@ const handleUpdate = async() => {
     emits('update-data', false);
   }
 }
+
+const Iscreate = ref(false)
+const handlecreate = async() => {
+  console.log(tableData.value.length)
+  if (tableData.value.length != 0) {
+    ElMessage({
+      type: 'error',
+      message: '已有投料记录,无法新增',
+    })
+    return
+  }else{
+    const res = await getFeedList({
+    workorder: props?.['gdbh'],
+    yjno: props?.['yjno'],
+  })
+  if (res.code === 0) {
+    tableData.value = res.data.map(item => ({
+      ...item,
+      单位: item.BOM_投料单位 || '张'  // 设置默认值
+    }))
+  }
+  Iscreate.value = true
+}
+}
+const oncreate = async() => {
+  if(!Iscreate.value){
+    ElMessage({
+      type: 'error',
+      message: '请先新增投料记录',
+    })
+    return
+  }
+  if (tableData.value[0]['实际投料'] === undefined) {
+    ElMessage({
+      type: 'error',
+      message: '未输入投料数量',
+    })
+    return
+  }else{const params = {
+      st_gdbh: tableData.value[0]['Gd_gdbh'],
+      st_wlbh: tableData.value[0]['yj_zzdh'],
+      st_sl: tableData.value[0]['实际投料'],
+      st_dw:tableData.value[0]['单位'],
+      sys_id:userStore.userInfo.nickName,
+      cpdh:tableData.value[0]['yj_yjdh'],
+    }
+    console.log(params)
+    const res = await feedAdd(params)
+    if (res['code'] === 0) {
+      ElMessage({
+        type: 'success',
+        message: '新增成功',
+      })
+      emits('update-data', false);
+    }
+    }
+    
+}
 </script>
 
 <style scoped>

Some files were not shown because too many files changed in this diff