liuhairui před 9 měsíci
rodič
revize
21ec85ef64
1 změnil soubory, kde provedl 275 přidání a 194 odebrání
  1. 275 194
      src/view/performance/chukubaogong.vue

+ 275 - 194
src/view/performance/chukubaogong.vue

@@ -1,41 +1,38 @@
 <template>
   <div>
     <layout>
-      <!-- <layout-header> -->
         <div class="gva-table-box">
-			<h1 style="margin: 0%;margin-bottom: 6px;">出库报工</h1>
+			<h1 style="margin: 0%;margin-bottom: 6px;">出库领料</h1>
 			<el-row :gutter="24" style="margin-bottom: 6px;">
-				  <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号条码"
+				  <el-input v-model="add_searchInfo" placeholder="请扫描订单号或输入生产款号进行领料"
 				  			  @keyup.enter="add_onSubmit"
 								  id="searchInput" 
-				  			  style="width: 250px;height: 50px;margin-left: 10px;">
+				  			  style="width: 340px;height: 50px;margin-left: 10px;">
 				  			  </el-input>
-				  <el-button type="primary" icon="search" @click="add_onSubmit" style="height: 50px;font-size: 20px;">查询</el-button>
-				  <el-button type="primary" icon="" @click="Restore_onSubmit" style="height: 50px;font-size: 20px;">恢复未出库</el-button>
-				  <el-button type="primary" icon="" @click="add_Dialog" style="height: 50px;font-size: 20px;">确认出库</el-button>
+				  <el-button type="primary" @click="Reporting_onSubmit" style="height: 50px;font-size: 20px;">报工</el-button>
+				  <el-button type="primary" icon="reading" @click="details_onSubmit" style="height: 50px;font-size: 20px;">出库退还记录</el-button>
 			</el-row>
 		</div>
-      <!-- </layout-header> -->
       <layout>
+		  
         <layout-content >
           <div class="gva-table-box">
            <el-table ref="multipleTable" style="width: 100%;height: 64vh" tooltip-effect="dark"
                       :row-style="{ height: '40px' }"  :header-cell-style="{ padding: '0px' }"
                       :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
-                      :data="add_tableData"  border row-key="ID" size="small"  
+                      :data="restableData"  border row-key="ID" size="small"  
 					  :cell-class-name="tableDataCellClass"
-                      highlight-current-row="true"  @row-dblclick="add_updateCompanyFunc"
-                      @row-click="add_tableRowClick" :show-overflow-tooltip="true"
+                      highlight-current-row="true"  @row-dblclick="updateCompanyFunc"
+                      @row-click="tableRowClick" :show-overflow-tooltip="true"
                       @selection-change="handleSelectionChange">
 			        <!-- <el-table-column type="selection" width="80" /> -->
               <el-table-column    align="left" label="订单编号" prop="订单编号" width="105" />
-              <el-table-column    align="left" label="子订单编号" prop="子订单编号" width="140"/>
-              <el-table-column    align="left" label="PO款号" prop="款号" width="220"/>
-              <el-table-column    align="left" label="款式" prop="款式" width="100"/>
-			  <el-table-column    align="left" label="颜色备注" prop="颜色备注" width="110"/>
-              <el-table-column    align="left" label="色系名称" prop="颜色" width="150"/>
-			  <el-table-column    align="left" label="是否出库" prop="是否出库" width="120"/>
-			  <el-table-column    align="left" label="出库日期" prop="ck_rq" width="120"/>
+			  <el-table-column    align="left" label="客户编号" prop="客户编号" width="80"/>
+              <el-table-column    align="left" label="生产款号" prop="生产款号" width="170"/>
+              <el-table-column    align="left" label="款式" prop="款式" width="170"/>
+			  <el-table-column    align="left" label="接单日期" prop="接单日期" width="160"/>
+              <el-table-column    align="left" label="创建人员" prop="创建人员" width="160"/>
+			  <el-table-column    align="left" label="创建时间" prop="创建时间" width="160"/>
             </el-table>
             <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
 			</div>
@@ -44,13 +41,117 @@
       </layout>
     </layout>
   </div>
-</template>
+  
+  <!-- 报工领用 -->
+  <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>
+  
+  <!-- 出库退还记录 -->
+  <el-dialog v-model="pickingaddvisible" :before-close="()=> pickingaddvisible = false" style="width: 70%; margin: 5% auto; height: 79%;" :title="'出库退还记录'" destroy-on-close>
+	   <div class="dialog-footer" style="bottom: 10px; right: 10px; width: 100%;">
+		 <el-button  type="primary" @click="ckth_closeDialog" style="width: 80px;height: 40px;">取 消</el-button>
+	   </div>
+	   <br>
+		<div>
+			<el-tabs v-model="activeName" @tab-click="handleClick">
+              <el-tab-pane label="出库记录"  @click="showTable('出库记录')"  name="first">
+                <el-table ref="multipleTable"
+                          :row-style="{ height: '20px' }"
+                          :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                          :header-cell-style="{ padding: '0px' }"
+                          :show-overflow-tooltip="true"
+                          highlight-current-row="true"
+						  @row-click="ystableclick"
+                          @row-dblclick="ysupdateCompanyFunc"
+                          style="width: 100%;height: 36vh" border show-summary
+                          :summary-method="getSummaries" tooltip-effect="dark" :data="ystableData" row-key="ID" >
+                  <el-table-column align="left" sortable label="订单编号" prop="订单编号"  width="140"/>
+				  <el-table-column align="left" sortable label="款号" prop="款号"  width="180"/>
+				  <el-table-column align="left" sortable label="数量" prop="数量"  width="105"/>
+                  <el-table-column align="left" sortable label="出库时间" prop="出库时间"  width="105"/>
+                  <el-table-column align="left" sortable label="上报机台" prop="上报机台"  width="120"/>
+				  
+                </el-table>
+              </el-tab-pane>
 
+              <el-tab-pane label="退还记录" @click="showTable('退还记录')" name="second">
+                <el-table ref="multipleTable"
+                          :row-style="{ height: '20px' }"
+                          :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                          :header-cell-style="{ padding: '0px' }"
+                          highlight-current-row="true"
+                          :show-overflow-tooltip="true"
+                          :cell-class-name="gysatusCellClass"
+                          @row-dblclick="gdgyupdateCompanyFunc"
+                          @row-click="clickybupdate2"
+                          :row-class-name="rowClassStyle2"
+                          style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="gytableData" row-key="ID">
+				  <el-table-column align="left" sortable label="订单编号" prop="订单编号"  width="140"/>
+				  <el-table-column align="left" sortable label="款号" prop="款号"  width="180"/>
+				  <el-table-column align="left" sortable label="数量" prop="数量"  width="105"/>
+                  <el-table-column align="left" sortable label="出库时间" prop="出库时间"  width="105"/>
+                  <el-table-column align="left" sortable label="上报机台" prop="上报机台"  width="120"/>
+                </el-table>
+              </el-tab-pane>
+		   </el-tabs>
+		</div>
+  </el-dialog>
+  
+</template>
+<script>
+//点击按钮显示下方表格
+export default {
+  data() {
+    return {
+      currentTable: '', // 当前展示的表格
+      activeName: 'first',
+      _ddhval:'',
+	  add_gddialogFormVisible: true,
+    };
+  },
+  methods: {
+    
+  }
+};
+</script>
 <script setup>
 // 全量引入格式化工具 请按需保留
 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
 import {ref, reactive} from 'vue'
-import {getSpotList,getSpotTab} from '@/api/mes/job'
+import {getSpotList,getSpotTab,orderSearch,outReport,orderBomList} from '@/api/mes/job'
 import {ElMessage} from "element-plus";
 // import { get } from 'scriptjs';
 defineOptions({name: 'Company'})
@@ -83,191 +184,173 @@ getMachineMacdata();
 
 //全局调用参数
 const add_searchInfo = ref('')//搜索
-const add_tableData = reactive([])//表格
+const restableData = reactive([])//表格
 const _orderid = ref('')//订单子编号
-const searcs = ref('')//默认记录扫描两次出库
+const _kh = ref('')//生产款号
 
 //表格行点击
-const add_tableRowClick = async (row)=>{
-//   add_searchInfo.value = row.子订单编号
+const tableRowClick = async (row)=>{
 	console.log(row)
-	_orderid.value = row.子订单编号
+	_orderid.value = row.订单编号
+	_kh.value = row.生产款号
 }
 
-//点击【查询按钮
+//查询按钮
 const add_onSubmit = async ()=>{
-	//自动聚焦光标input
-	getMachineMacdata();
-	
-  if(add_searchInfo.value === ''){
-    const WorkListdata = [];
-	searcs.value = '';
-    add_tableData.splice(0,add_tableData.length,...WorkListdata);
-    ElMessage({type: 'warning',message: '请扫描子订单编号' })
-  }else{
-	  if (add_searchInfo.value.includes('-')) {//子订单编号
-		  if(searcs.value == ''){ //第一次扫码 查询数据
-			  console.log("查询子订单编号数据")
-			  const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});//出库报工修改
-			  add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
-			  add_searchInfo.value = ''
-			  searcs.value = 1;
-			  return;
-		  }
-		  if(searcs.value == 1){//第二次扫码,如果两次相同代表可以出库
-			if(add_tableData[0]['子订单编号'] === add_searchInfo.value){
-				console.log("出库")
-				add_Dialogs();//调用出库按钮
-				searcs.value = '';
-			}else{
-				ElMessage({type: 'warning',message: '两次扫码不一致,请重新扫描子订单出库' })
-				searcs.value = '';
-				const WorkListdata = [];
-				add_tableData.splice(0,add_tableData.length,...WorkListdata);
-				add_searchInfo.value = ''
-			}
-		  }
-	  } else {//订单编号
-			console.log("查询订单编号数据")
-			const WorkListdata = [];
-			searcs.value = '';
-			const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});
-			add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
-			add_searchInfo.value = ''
-	  }
-    
-  }
+	restableData.splice(0, restableData.length);
+	//订单信息数据查询【接口】
+	const orderSearchdata = await orderSearch({search:add_searchInfo.value});
+	console.log(orderSearchdata)
+	if(orderSearchdata.data.length === 1){
+		res_bomdialogFormVisible.value = true
+		_orderid.value = orderSearchdata.data[0]['订单编号']
+		Reporting_onSubmit()
+	}
+	restableData.splice(0,orderSearchdata.length,...orderSearchdata.data);
 };
 
-//确认出库按钮
-const add_Dialog = async () => {
-	// console.log("确认出库按钮")
-	let params = {}
-	if(_orderid.value === ''){
-		params.order_id = add_tableData[0]['子订单编号'];
-	}else{
-		params.order_id = _orderid.value;
-	}
-	params.code = '出库';
-	params.sys_id = _username.value;
-	const ck_gettab = await getSpotTab(params);// 发起出库请求
-	if (ck_gettab.code === 0) {// 出库成功后的处理
-		searcs.value = '';
-		ElMessage({ type: 'success', message: '出库成功'});
-		const getSpotLists = await getSpotList({order:params.order_id,code: '出库'});// 获取并更新表格数据
-		add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-		add_searchInfo.value = ''
-	}else {
-		searcs.value = '';
-	    const getSpotLists = await getSpotList({order: params.order_id, code: '出库'}); // 出库失败,重新获取数据
-	    add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-	  }
-}
 
-//确认出库按钮
-const add_Dialogs = async () => {
-	if(add_tableData[0]['子订单编号'] === add_searchInfo.value){
-		 let params = {
-		   order_id: add_searchInfo.value,
-		   code: '出库',
-		   sys_id: _username.value,
-		 };
-		 console.log(params)
-			const ck_gettab = await getSpotTab(params);// 发起出库请求
-			if (ck_gettab.code === 0) {// 出库成功后的处理
-				 searcs.value = '';
-				 ElMessage({ type: 'success', message: '出库成功' });
-				 const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' });// 获取并更新表格数据
-				 add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-				 add_searchInfo.value = ''
-			}else {
-			 searcs.value = '';
-		     const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' }); // 出库失败,重新获取数据
-		     add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-		   }
+//===========报工==========
+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 Reporting_onSubmit = async ()=>{
+	if(_orderid.value === '' || _orderid.value === null){
+		ElMessage({type: 'warning',message: '请扫描订单后,再操作此功能'})
 	}else{
-		 ElMessage({type: 'warning',message: '两次扫码不一致,请重新扫描子订单出库' })
-		 searcs.value = '';
-		 const WorkListdata = [];
-		 add_tableData.splice(0,add_tableData.length,...WorkListdata);
-		 add_searchInfo.value = ''
+		res_bomdialogFormVisible.value = true
+		ddhformData.ddh = _orderid.value
+		ddhformData.kh = _kh.value
+		const orderBomListlsit = await orderBomList({order:_orderid.value});
+		console.log(orderBomListlsit)
+		_TestCoefficient();
 	}
-	return false;
-	
-//下面代码代表多条出库
-  if (add_tableData.length > 1) {
-	searcs.value = '';
-    ElMessage({ type: 'warning', message: '出库出现多条数据'});
-    return;
-  }
-  const orderData = add_tableData[0];
-  if (add_tableData[0]['子订单编号'] !== add_searchInfo.value) {
-	const WorkListdata = [];
-	searcs.value = '';
-	const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});
-	add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
-	return;
-  }
-  let params = {
-    order_id: orderData['子订单编号'],
-    code: '出库',
-    sys_id: _username.value,
-  };
+}
+//bom数据获取
+const _TestCoefficient = async ()=>{
   try {
-    // 发起出库请求
-    const ck_gettab = await getSpotTab(params);
-    if (ck_gettab.code === 0) {
-      // 出库成功后的处理
-      add_searchInfo.value = '';
-      searcs.value = '';
-      ElMessage({ type: 'success', message: '出库成功' });
-      // 获取并更新表格数据
-      const getSpotLists = await getSpotList({ order: orderData['子订单编号'], code: '出库' });
-      add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-    } else {
-		searcs.value = '';
-      // 出库失败,重新获取数据
-      const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' });
-      add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
-    }
+    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);
-    ElMessage({ type: 'error', message: '出库请求失败,请稍后重试' });
+    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 Restore_onSubmit = async ()=>{
-	if(_orderid.value === '' || _orderid.value === null){
-		ElMessage({type: 'warning',message: '请点击点击恢复的子订单编号' })
-	}else{
-		let params = {}
-		params.order_id = _orderid.value;
-		params.code_ck_rq = currentDates;
-		params.code = '恢复';
-		params.sys_id = _username.value;
-		const ck_gettab = await getSpotTab(params);
-		if (ck_gettab.code === 0) {
-		searcs.value = '';
-		add_searchInfo.value = ''
-		ElMessage({type: 'success',message: '恢复成功'});
-		const getSpotLists = await getSpotList({order:_orderid.value,code:'出库'});
-		add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
-		}
+// 确定
+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 pickingaddvisible = ref(false)//弹窗
+// const detailData = reactive({})
+const add_prinkformData = reactive({});
+//详情按钮
+const details_onSubmit = async ()=>{
+	pickingaddvisible.value = true
+	
+}
+//领料取消
+const ckth_closeDialog = async ()=>{
+	pickingaddvisible.value = false
 	//自动聚焦光标input
 	getMachineMacdata();
 }
 
-//复选框选择
-const ckSelection = ref('')
-const handleSelectionChange = (selection, type) => {
-  const ids = selection.map(item => {
-    return item.子订单编号
-  })
-  ckSelection.value = ids.join(',')
-  console.log(ckSelection.value)
-}
 
 // =========== 分页 ===========
 // 分页相关的响应式变量
@@ -286,16 +369,6 @@ const handleSizeChange = (val) => {
   pageSize.value = val;
   _getStaffList();
 };
-
-//根据出库状态文字颜色
-const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
-  if(row['是否出库'] === '已出库'){
-    return 'status-plan-usage-low';
-  }
-  if(row['是否出库'] === '未出库'){
-    return 'statusy-plan-usage-low';
-  }
-}
 </script>
 <style scoped>
 /* 根据出库状态文字颜色 */
@@ -346,6 +419,14 @@ const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
     width: 45px; /* 复选框宽度 */
     height: 23px; /* 复选框高度 */
 }
+/*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;
+}
 :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
     transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
     top: 5%; /* 调整对勾位置 */