Pārlūkot izejas kodu

裁剪报工优化

zck 9 mēneši atpakaļ
vecāks
revīzija
0f0a83b2c1
1 mainītis faili ar 173 papildinājumiem un 1 dzēšanām
  1. 173 1
      src/view/performance/caiqiebaogong.vue

+ 173 - 1
src/view/performance/caiqiebaogong.vue

@@ -182,6 +182,7 @@
 					  style="width: 150px; height: 40px; font-size: 20px; margin-left: 10px;">删除报工</el-button>
 					  <el-button type="primary" @click="cp_gdprintonClick" style="width: 150px; height: 40px; font-size: 20px; margin-left: 10px;" >  子订单详情页 </el-button>
 					  <el-button type="primary" @click="add_Dialog" style="width: 100px; height: 40px; font-size: 20px; margin-left: 10px;" >报工</el-button>
+					  <el-button type="primary" @click="return_Dialog" style="width: 100px; height: 40px; font-size: 20px; margin-left: 10px;" >退还</el-button>
 				</el-main>
 			</div>
 			
@@ -194,6 +195,42 @@
 					</div>
 				</el-dialog>
 				
+				  <!-- 退还 -->
+					<el-dialog v-model="res_bomdialogFormVisible" :before-close="res_bomcloseDialog" title="报工领用" width="100%" top="2%" destroy-on-close>
+						<div class="dialog-footer">
+						<el-button @click="res_bomcloseDialog">取消</el-button>
+						<el-button type="primary" @click="res_bomenterDialog">确定</el-button>
+						</div>
+						<div style="width: 100%; height: 60px; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;">
+						<el-form-item label="订单编号 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
+							<el-input v-model="ddhformData['ddh']" disabled style="width: 200px;"/>
+						</el-form-item>
+						<el-form-item label="生产款号 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
+							<el-input v-model="ddhformData['kh']" disabled style="width: 200px;"/>
+						</el-form-item>
+						</div>
+						<div>
+							<el-table ref="paichengRef"
+									:show-overflow-tooltip="true"
+									highlight-current-row="true"
+									:row-style="{ height: '0px' }"
+									:cell-style="{ padding: '0px' }" :header-row-style="{ height: '0px' }"
+									:header-cell-style="{ padding: '0px' }"
+									style="width: 100%;height: 60vh" border tooltip-effect="dark"
+									:data="resbomtableData" row-key="ID"
+									:cell-class-name="scfjfpxsCellClass">
+							<template v-for="(item, idx) in resbom_tableColumns">
+								<el-table-column #default="{ row, column, $index }" align="left" :label="item.label" :width="item.width" >
+								<div v-if="['退还'].includes(item.prop)">
+									<el-input v-model="row[item.prop]" :clearable="false"
+											:id="`input${idx}${$index}`" @keyup="resbom_handleKeyDown($event, idx, $index, item.prop)"/>
+								</div>
+								<div v-else>{{ row[item.prop] }}</div>
+								</el-table-column>
+							</template>
+							</el-table>
+						</div>
+					</el-dialog>
 				
         </layout-content>
       </layout>
@@ -263,7 +300,7 @@ import $ from 'jquery';
 import LuckyExcel from 'luckyexcel';
 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
 import {ref, reactive} from 'vue';
-import {getSpotList,getInfo,OrderAttachments,getTabByGdbh,search,spotcheckdel,SubWorkOrderStatusList,Mabaolist} from '@/api/mes/job';
+import {getSpotList,getInfo,OrderAttachments,getTabByGdbh,search,spotcheckdel,SubWorkOrderStatusList,Mabaolist,orderBomList,orderSearch,outReport} from '@/api/mes/job';
 import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
 import {getMac} from '@/api/jixiaoguanli/baogong'
 import {ElMessage} from "element-plus";
@@ -726,6 +763,136 @@ const del_delclick = async () => {
 	add_onSubmit()
 }
 
+const _orderid = ref('')//订单子编号
+const _kh = ref('')//生产款号
+
+//===========报工==========
+const res_bomdialogFormVisible = ref(false)
+const resbomtableData = ref([]);
+const ddhformData = reactive({
+  ddh: '',
+  kh:''
+});
+const resbom_tableColumns = ref(
+    [
+      { label: '物料名称', prop: '物料名称', width: '200' },
+      { label: '计划用料', prop: '计划用料', width: '110' },
+	  { label: '定额用料', prop: '定额用料', width: '90' },
+	  { label: '裁床实际用料', prop: '裁床实际用料', width: '120' },
+	  { label: '裁床领用面料', prop: '裁床领用面料', width: '120' },
+	  { label: '裁床退回仓库面料', prop: '裁床退回仓库面料', width: '160' },
+	  { label: '退还', prop: '退还', width: '110' },
+	  // { label: '备注', prop: '备注', width: '120' },
+	  { label: '投料单位', prop: '投料单位', width: '100' },
+	  // { label: 'UNIQID', prop: 'UNIQID', width: '80' },
+    ]
+)
+//退还按钮
+const return_Dialog = async ()=>{
+	_orderid.value = add_searchInfo.value.split('-')[0]
+	if(_orderid.value === '' || _orderid.value === null){
+		ElMessage({type: 'warning',message: '请扫描订单后,再操作此功能'})
+	}else{
+		const orderSearchdata = await orderSearch({search:_orderid.value});
+		console.log(orderSearchdata)
+		_kh.value = orderSearchdata.data[0].生产款号
+		res_bomdialogFormVisible.value = true
+		ddhformData.ddh = _orderid.value
+		ddhformData.kh = _kh.value
+		const orderBomListlsit = await orderBomList({order:_orderid.value});
+		console.log(orderBomListlsit)
+		_TestCoefficient();
+	}
+}
+//bom数据获取
+const _TestCoefficient = async ()=>{
+  try {
+    const orderBomListdata = await orderBomList({order:_orderid.value});
+	console.log(orderBomListdata)
+	resbomtableData.value = orderBomListdata.data;
+    const formattedData = orderBomListdata.data.map(item=>{
+      item.物料名称 = item.物料名称;
+      item.计划用料 = item.计划用料;
+	  item.定额用料 = item.定额用料;
+	  item.裁床实际用料 = item.裁床实际用料;
+	  item.裁床领用面料 = item.裁床领用面料;
+	  item.裁床退回仓库面料 = item.裁床退回仓库面料;
+	  item.备注 = item.备注;
+	  item.UNIQID = item.UNIQID;
+	  item.领用 = '';
+      return item
+    });
+  } catch (error) {
+    console.error(error);
+  }
+}
+const resbom_handleKeyDown = (event, x, y, prop) => {
+  const currentElement = document.getElementById(`input${x}${y}`);
+  if (currentElement === null && currentElement === undefined) return
+  let move = 0
+  switch (event.keyCode) {
+    case 13: // Enter
+    case 40: // 向下箭头
+      if (y < resbomtableData.value.length )
+        document.getElementById(`input${x}${y + 1}`).focus();
+      break;
+    case 38: // 向上箭头
+      if ( y > 0) {
+        document.getElementById(`input${x}${y - 1}`).focus();
+      }
+      break;
+    case 39: // 向左箭头
+      if (x >= 0 && x <=6) {
+        move = x + 1
+      }
+      document.getElementById(`input${move}${y}`).focus();
+      break;
+    case 37: // 向右箭头
+      if (x = 0  && x <=6) {
+        move = x - 1
+      }
+      document.getElementById(`input${move}${y}`).focus();
+      break;
+    default:
+      break;
+  }
+}
+//质检废品系数颜色
+const scfjfpxsCellClass = ({row, column, rowIndex, columnIndex}) =>{
+  if (column.label === '退还') {
+    return 'background-plan-usage-low';
+  }
+}
+
+// 确定
+const res_bomenterDialog = async() => {
+	const rawValueArray = resbomtableData._rawValue;
+	const formattedData = rawValueArray.map(item => {
+	  return {
+	    order_id: ddhformData.ddh,
+	    款号: ddhformData.kh,
+	    物料名称: item.物料名称 !== null ? item.物料名称 : "",
+	    number: item.退还 !== null ? item.退还 : "",
+	    rq: currentDate,
+	    name: "退还",
+		sys_id: _username.value
+	  }
+	});
+	console.log(formattedData);
+	const add_outReport = await outReport(formattedData);
+	if (add_outReport.code === 0) {
+		res_bomdialogFormVisible.value = false;
+		ElMessage({type: 'success',message: '退还成功'})
+	} else {
+		ElMessage({ type: 'error',message: '退还失败'})
+	}
+}
+
+// 取消
+const res_bomcloseDialog = () => {
+	res_bomdialogFormVisible.value = false;
+}
+
 // =========== 分页 ===========
 // 分页相关的响应式变量
 const page = ref(1)
@@ -815,6 +982,10 @@ const handleSizeChange = (val) => {
   background: oldlace;
 }
 
+/*bom参数背景*/
+:deep(.el-table__body .background-plan-usage-low div div div) {
+  background: #80FA80 !important;
+}
 /* 选中某行时的背景色 */
 :deep(.el-table__body tr.current-row) > td {
   background: #ff80ff !important;
@@ -983,4 +1154,5 @@ const handleSizeChange = (val) => {
 	height: 9px;
 	/* 调整对勾高度 */
 }
+
 </style>