Browse Source

Merge branch 'master' of https://git.7in6.com/Minong/mes-admin-backend-ui

曹鹤洋 1 year ago
parent
commit
ce8b3b3441

+ 9 - 0
src/api/mes/job.js

@@ -193,6 +193,7 @@ export const JunkDetailAdd = (data) => {
     data
     data
   })
   })
 }
 }
+//1.1获取工单基本数据
 export const getDocumentData = (params) => {
 export const getDocumentData = (params) => {
   return service({
   return service({
     url: '/mes_server/process_document/getData',
     url: '/mes_server/process_document/getData',
@@ -200,6 +201,14 @@ export const getDocumentData = (params) => {
     params
     params
   })
   })
 }
 }
+//1.2获取历史工艺信息
+export const getHistory = (params) => {
+  return service({
+    url: '/mes_server/process_document/getHistory',
+    method: 'get',
+    params
+  })
+}
 export const getDocumentHistory = (params) => {
 export const getDocumentHistory = (params) => {
   return service({
   return service({
     url: '/mes_server/process_document/getHistory',
     url: '/mes_server/process_document/getHistory',

+ 8 - 0
src/api/yunyin/yunying.js

@@ -944,3 +944,11 @@ export const WorkOrderDetailListCope = (data) => {
     })
     })
 }
 }
 
 
+//工单同步
+export const WorkOrderData= (params) => {
+    return service({
+        url:'/mes_server/Synchronization/WorkOrderData',
+        method: 'get',
+        params
+    })
+}

+ 221 - 155
src/view/job/processSheet/processSheet.vue

@@ -11,7 +11,7 @@
 		                    <th style="width:40%;"><span>字段</span> </th>
 		                    <th style="width:40%;"><span>字段</span> </th>
 		                    <th><span>值</span></th>
 		                    <th><span>值</span></th>
 		                </tr>
 		                </tr>
-		                <tr >
+		                <tr>
 		                    <td><span>生产批次号</span></td>
 		                    <td><span>生产批次号</span></td>
 		                    <td><input name="Gd_gdbh" type="text" v-model="workData.Gd_gdbh" @input="propertyChange" class="required" style="width: 380px;height: 30px;"></td>
 		                    <td><input name="Gd_gdbh" type="text" v-model="workData.Gd_gdbh" @input="propertyChange" class="required" style="width: 380px;height: 30px;"></td>
 		                </tr>
 		                </tr>
@@ -100,7 +100,7 @@
 	                 <table width="100%" border="1" class="new_craft" id="new_craft">
 	                 <table width="100%" border="1" class="new_craft" id="new_craft">
 	             	   <caption>工艺</caption>
 	             	   <caption>工艺</caption>
 	             		  <tr>
 	             		  <tr>
-							  <td width="40%">上次<span style="color: red">{{department}}</span>工艺更新时间:<span style="color: red">{{update}}</span></td>
+							  <td width="40%">上次<span style="color: red">{{department}}</span>工艺更新时间:<span style="color: red" class="shijian">{{update}}</span></td>
 							  <td>
 							  <td>
 							      <input type="button" style="margin-left: 1px;" value="增加工艺" @click="addInput"/>
 							      <input type="button" style="margin-left: 1px;" value="增加工艺" @click="addInput"/>
 							  </td>
 							  </td>
@@ -125,6 +125,7 @@
 	  getDocumentData,
 	  getDocumentData,
 	  getDocumentHistory,
 	  getDocumentHistory,
 	  saveDocumentData,
 	  saveDocumentData,
+    getHistory,
 	  getDocumentInfo
 	  getDocumentInfo
 	} from '@/api/mes/job'
 	} from '@/api/mes/job'
 	import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
 	import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
@@ -156,160 +157,7 @@
 	const selectedPaper = ref([])
 	const selectedPaper = ref([])
 	const selectedPeijian = ref([])
 	const selectedPeijian = ref([])
 	const datas = ref([])
 	const datas = ref([])
-	const propertyChange = () => {
-		if(workData.value.Gd_gdbh.length<7){
-      console.log("没到七位")
-			shuang.value=false
-			selectedPaper.value=[]
-			selectedPeijian.value=[]
-			gyData.value=[]
-			workData.value.tldx=3000
-			workData.value.start_liucheng=1
-			workData.value.liucheng_num=1
-			workData.value.x_offset=0
-			workData.value.y_offset=0
-			department.value=null
-			department.value=null
-			return false;
-		}else{
-      console.log("到了七位")
-      const getDocument = async() => {
-        const getDocumentDatas = await getDocumentData({order:workData.value.Gd_gdbh})
-        console.log(getDocumentDatas)
-        if (getDocumentDatas.code === 0) {
-          workData.value.version=getDocumentDatas.data.paper[0].产品版本号;
-          workData.value.peijian=getDocumentDatas.data.paper;
-          console.log(selectedPaper.value)
-          if(getDocumentDatas.data.num>1){
-            dan.value=false
-            shuang.value=true
-            console.log(getDocumentDatas.data.paper.length)
-            selectedPaper.value=getDocumentDatas.data.paper
-            selectedPeijian.value=getDocumentDatas.data.peijian
 
 
-          }else{
-            dan.value=true
-            shuang.value=false
-            selectedPaper.value=getDocumentDatas.data.paper
-            workData.value.product=getDocumentDatas.data.paper[0].bom_物料名称;
-          }
-          workData.value.num=getDocumentDatas.data.paper[0].bom_计划用量;
-          if(getDocumentDatas.data.peijian){
-            peijian.value=getDocumentDatas.data.peijian[0]['id']
-            const getHistory = async() => {
-              const getDocumentHistorys = await getDocumentHistory({
-                order:workData.value.Gd_gdbh,
-                peijian:getDocumentDatas.data.peijian[0]['id']})
-              if (getDocumentHistorys.code === 0) {
-                department.value=getDocumentHistorys.data.department
-                update.value=getDocumentHistorys.data.update
-                gyData.value=getDocumentHistorys.data.data.map((item)=>({
-                  gy:item
-                }))
-              }
-            }
-            getHistory()
-          }
-        }
-      }
-      getDocument()
-    }
-	}
-	const addInput = () => {
-	 gyData.value.push({gy:''})
-	}
-	const sendClick = () => {
-		saveDocument()
-	}
-  const saveDocument = async() => {
-    datas.value=[]
-    gyData.value.map((item)=>{
-      if(item.gy==''){
-      }else{
-        datas.value.push(item.gy)
-      }
-    })
-    // datas.value = gyData.value.map((item)=>(item.gy))
-    data.value= datas.value.join(",")
-    const saveDocumentDatas = await saveDocumentData({order:workData.value.Gd_gdbh,data:`${data.value},`,peijian:peijian.value})
-    if (saveDocumentDatas.code === 0) {
-      getDocument()
-    }
-  }
-  const getDocument = async() => {
-    console.log(111111)
-
-    const getDocumentInfos = await getDocumentInfo({
-      order:workData.value.Gd_gdbh,
-      mabao:workData.value.mabao,
-      version:workData.value.version,
-      start_liucheng:workData.value.start_liucheng,
-      tldx:workData.value.tldx,
-      remark:workData.value.remark,
-      string:data.value,
-      num:workData.value.num
-    })
-
-    if (getDocumentInfos.code === 0) {
-      const data = getDocumentInfos.data
-      for (let i = workData.value.start_liucheng; i <= workData.value.liucheng_total; i++) {
-        const printdata  = {
-          "scpch": getDocumentInfos.data[0].Gd_gdbh,
-          "xsddh": getDocumentInfos.data[0].销售订单号.split(' ')[1],
-          "mbh": getDocumentInfos.data[0].mabao,
-          "lcdh": `${workData.value.liucheng_total}-${i}`,
-          "qrcode": `${getDocumentInfos.data[0].Gd_gdbh}-${workData.value.liucheng_total}-${i}`,
-          "gdsm": getDocumentInfos.data[0].technique_sequence,
-          "cpmc":  getDocumentInfos.data[0].Gd_cpmc,
-          "ztzs":  workData.value.num,
-          // "gjh":  getDocumentInfos.data[0].version,
-          'table': getDocumentInfos.data.gy_data.map(item=>({
-            gxmc:item
-          }))
-        }
-        hiprintTemplate.print2(printdata);
-        // hiprintTemplate.toPdf(printdata,'流程单');
-      }
-      // const printdata  = {
-      //   "scpch": "123456",
-      //   "xsddh": "123456",
-      //   "mbh": "123456",
-      //   "lcdh": "123456",
-      //   "gdsm": "123456",
-      //   "cpmc":  "111",
-      //   "ztzs":  "222",
-      //   "gjh":  "333",
-      //   'table': getDocumentInfos.data.gy_data.map(item=>({
-      //     gxmc:item
-      //   }))
-      // }
-      // hiprintTemplate.print(printdata);
-      console.log(getDocumentInfos.data)
-    }
-  }
-	const selectpPaper = (event) => {
-		 workData.value.num=event.target.value
-	}
-
-	const selectPeijian = async(event) => {
-    peijian.value=event.target.value
-		 const getDocumentHistoryss = await getDocumentHistory({
-		 	order:workData.value.Gd_gdbh,
-		 	peijian:event.target.value})
-			console.log(getDocumentHistoryss)
-		 if (getDocumentHistoryss.code === 0) {
-		 		department.value=getDocumentHistoryss.data.department
-		 		update.value=getDocumentHistoryss.data.update
-        if(getDocumentHistoryss.data.data[0]){
-          gyData.value=getDocumentHistoryss.data.data.map((item)=>({
-            gy:item
-          }))
-        }else{
-          gyData.value=[]
-        }
-
-		 }
-	}
   //在使用中的不带边框的模板
   //在使用中的不带边框的模板
   const jsondata1= {
   const jsondata1= {
     "panels": [
     "panels": [
@@ -4166,6 +4014,224 @@
   hiprint.init()
   hiprint.init()
   const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata1 })
   const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata1 })
 
 
+	const propertyChange = () => {
+		if(workData.value.Gd_gdbh.length<7){
+      console.log("没到七位")
+			shuang.value=false
+			selectedPaper.value=[]
+			selectedPeijian.value=[]
+			gyData.value=[]
+			workData.value.tldx=3000
+			workData.value.start_liucheng=1
+			workData.value.liucheng_num=1
+			workData.value.x_offset=0
+			workData.value.y_offset=0
+			department.value=null
+			department.value=null
+			return false;
+		}else{
+      console.log("到了七位")
+      console.log(workData.value.Gd_gdbh)
+      const getDocument = async() => {
+        //1.1获取工单基本数据
+        const getDocumentDatas = await getDocumentData({order:workData.value.Gd_gdbh})
+        console.log(getDocumentDatas)
+        //1.2获取历史工艺信息
+        const getHistorys = await getHistory({order:workData.value.Gd_gdbh,peijian:''})
+        update.value = getHistorys.data.update
+        gyData.value=getHistorys.data.data.map((item)=>({
+          gy:item
+        }))
+        console.log(getHistorys.data.data)
+
+        if (getDocumentDatas.code === 0) {
+          workData.value.version=getDocumentDatas.data.paper[0].产品版本号;
+          workData.value.peijian=getDocumentDatas.data.paper;
+          // console.log(selectedPaper.value)
+          if(getDocumentDatas.data.num>1){
+            dan.value=false
+            shuang.value=true
+            // console.log(getDocumentDatas.data.paper.length)
+            selectedPaper.value=getDocumentDatas.data.paper
+            selectedPeijian.value=getDocumentDatas.data.peijian
+
+          }else{
+            dan.value=true
+            shuang.value=false
+            selectedPaper.value=getDocumentDatas.data.paper
+            workData.value.product=getDocumentDatas.data.paper[0].bom_物料名称;
+          }
+          workData.value.num=getDocumentDatas.data.paper[0].bom_计划用量;
+          if(getDocumentDatas.data.peijian){
+            peijian.value=getDocumentDatas.data.peijian[0]['id']
+            const getHistory = async() => {
+              const getDocumentHistorys = await getDocumentHistory({
+                order:workData.value.Gd_gdbh,
+                peijian:getDocumentDatas.data.peijian[0]['id']})
+              if (getDocumentHistorys.code === 0) {
+                department.value=getDocumentHistorys.data.department
+                update.value=getDocumentHistorys.data.update
+                gyData.value=getDocumentHistorys.data.data.map((item)=>({
+                  gy:item
+                }))
+              }
+            }
+            getHistory()
+          }
+        }
+      }
+      getDocument()
+    }
+	}
+  //点击增加工艺按钮
+	const addInput = () => {
+	 gyData.value.push({gy:''})
+	}
+	const sendClick = () => {
+		saveDocument()
+	}
+  const saveDocument = async() => {
+    datas.value=[]
+    gyData.value.map((item)=>{
+      if(item.gy==''){
+      }else{
+        datas.value.push(item.gy)
+      }
+    })
+    // datas.value = gyData.value.map((item)=>(item.gy))
+    data.value= datas.value.join(",")
+    const saveDocumentDatas = await saveDocumentData({order:workData.value.Gd_gdbh,data:`${data.value},`,peijian:peijian.value})
+    if (saveDocumentDatas.code === 0) {
+      getDocument()
+    }
+  }
+  const getDocument = async() => {
+    console.log(111111)
+    const getDocumentInfos = await getDocumentInfo({
+      order:workData.value.Gd_gdbh,
+      mabao:workData.value.mabao,
+      version:workData.value.version,
+      start_liucheng:workData.value.start_liucheng,
+      tldx:workData.value.tldx,
+      remark:workData.value.remark,
+      string:data.value,
+      num:workData.value.num
+    })
+    if (getDocumentInfos.code === 0) {
+      // const printdata  = {
+      //   "scpch": "123456",
+      //   "xsddh": "123456",
+      //   "mbh": "123456",
+      //   "lcdh": "123456",
+      //   "gdsm": "123456",
+      //   "cpmc":  "111",
+      //   "ztzs":  "222",
+      //   "gjh":  "333",
+      //   'table': getDocumentInfos.data.gy_data.map(item=>({
+      //     gxmc:item
+      //   }))
+      // }
+      // hiprintTemplate.print(printdata);
+
+      console.log(workData)
+      const data = getDocumentInfos.data
+      if(workData.value.liucheng_total=== '' || workData.value.liucheng_total === null){
+        ElMessage({type: 'warning',message: '总流程不能为空'})
+        return false;
+      }
+      console.log(workData.value.start_liucheng)//这个是1
+      console.log(workData.value.liucheng_total)//这个是2 就是打印两次
+
+
+      for (let i = workData.value.start_liucheng; i <= workData.value.liucheng_total; i++) {
+        ((i) => {
+          const printdata  = {
+            "scpch": getDocumentInfos.data[0].Gd_gdbh,
+            "xsddh": getDocumentInfos.data[0].销售订单号.split(' ')[1],
+            "mbh": getDocumentInfos.data[0].mabao,
+            "lcdh": `${workData.value.liucheng_total}-${i}`,
+            "qrcode": `${getDocumentInfos.data[0].Gd_gdbh}-${workData.value.liucheng_total}-${i}`,
+            "gdsm": getDocumentInfos.data[0].technique_sequence,
+            "cpmc": getDocumentInfos.data[0].Gd_cpmc,
+            "ztzs": workData.value.num,
+            'table': getDocumentInfos.data.gy_data.map(item => ({
+              gxmc: item
+            }))
+          };
+
+          hiprintTemplate.print2(printdata);
+          // hiprintTemplate.toPdf(printdata,'流程单');
+        })(i);
+      }
+
+
+
+
+      // for (let i = workData.value.start_liucheng; i <= workData.value.liucheng_total; i++) {
+      //   const printdata  = {
+      //     "scpch": getDocumentInfos.data[0].Gd_gdbh,
+      //     "xsddh": getDocumentInfos.data[0].销售订单号.split(' ')[1],
+      //     "mbh": getDocumentInfos.data[0].mabao,
+      //     "lcdh": `${workData.value.liucheng_total}-${i}`,
+      //     "qrcode": `${getDocumentInfos.data[0].Gd_gdbh}-${workData.value.liucheng_total}-${i}`,
+      //     "gdsm": getDocumentInfos.data[0].technique_sequence,
+      //     "cpmc":  getDocumentInfos.data[0].Gd_cpmc,
+      //     "ztzs":  workData.value.num,
+      //     // "gjh":  getDocumentInfos.data[0].version,
+      //     'table': getDocumentInfos.data.gy_data.map(item=>({
+      //       gxmc:item
+      //     }))
+      //   }
+      //
+      //   // hiprintTemplate.print(printdata);
+      //   hiprintTemplate.print2(printdata);
+      //   // hiprintTemplate.toPdf(printdata,'流程单');
+      // }
+
+      // const printdata  = {
+      //   "scpch": "123456",
+      //   "xsddh": "123456",
+      //   "mbh": "123456",
+      //   "lcdh": "123456",
+      //   "gdsm": "123456",
+      //   "cpmc":  "111",
+      //   "ztzs":  "222",
+      //   "gjh":  "333",
+      //   'table': getDocumentInfos.data.gy_data.map(item=>({
+      //     gxmc:item
+      //   }))
+      // }
+      // hiprintTemplate.print(printdata);
+
+      // hiprintTemplate.print(printdata);
+      // console.log(getDocumentInfos.data)
+    }
+  }
+	const selectpPaper = (event) => {
+		 workData.value.num=event.target.value
+	}
+
+	const selectPeijian = async(event) => {
+    peijian.value=event.target.value
+		 const getDocumentHistoryss = await getDocumentHistory({
+		 	order:workData.value.Gd_gdbh,
+		 	peijian:event.target.value})
+			console.log(getDocumentHistoryss)
+		 if (getDocumentHistoryss.code === 0) {
+		 		department.value=getDocumentHistoryss.data.department
+		 		update.value=getDocumentHistoryss.data.update
+        if(getDocumentHistoryss.data.data[0]){
+          gyData.value=getDocumentHistoryss.data.data.map((item)=>({
+            gy:item
+          }))
+        }else{
+          gyData.value=[]
+        }
+
+		 }
+	}
+
+
 </script>
 </script>
 
 
 <style>
 <style>

+ 9 - 1
src/view/yunyin/shengchanguanli/gongdanziliao.vue

@@ -24,6 +24,7 @@
               <el-button type="primary" icon="edit"   @click="addgdyj_onclick"   class="bt" title="新增印件资料">新增印件资料</el-button>
               <el-button type="primary" icon="edit"   @click="addgdyj_onclick"   class="bt" title="新增印件资料">新增印件资料</el-button>
               <el-button type="primary" icon="edit"   @click="addgdgy_onclick"   class="bt" title="新增工艺资料" >新增工艺资料</el-button>
               <el-button type="primary" icon="edit"   @click="addgdgy_onclick"   class="bt" title="新增工艺资料" >新增工艺资料</el-button>
               <el-button type="primary" icon="edit"   @click="delgd_delclick"  :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除(印件资料或工艺资料)"  >删除</el-button>
               <el-button type="primary" icon="edit"   @click="delgd_delclick"  :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除(印件资料或工艺资料)"  >删除</el-button>
+              <el-button type="primary" icon="edit"   @click="gdtb_onclick"   class="bt" title="工单资料同步" >工单同步</el-button>
             </el-form-item>
             </el-form-item>
           </el-form>
           </el-form>
 
 
@@ -1327,7 +1328,7 @@ import {
   DataCorrection, U8Trial, ProcessFlow, AccountingParameter,setProductStatus,
   DataCorrection, U8Trial, ProcessFlow, AccountingParameter,setProductStatus,
   getProduct, getProductGy, ProductInformationEdit, workOrderListDetail, editProduct, getOrderProcessCount, StatusEdit,
   getProduct, getProductGy, ProductInformationEdit, workOrderListDetail, editProduct, getOrderProcessCount, StatusEdit,
   PrintDetailDel, ProcessDetailDel,WorkOrderDetailCope,
   PrintDetailDel, ProcessDetailDel,WorkOrderDetailCope,
-  getGdAnnexTable,
+  getGdAnnexTable,WorkOrderData,
   gdAnnexAdd,ProductCopeDetail,WorkOrderDetailListCope,
   gdAnnexAdd,ProductCopeDetail,WorkOrderDetailListCope,
   gdAnnexDel,
   gdAnnexDel,
 } from "@/api/yunyin/yunying";
 } from "@/api/yunyin/yunying";
@@ -2386,6 +2387,13 @@ const addgdgy_onclick = () => {
   }
   }
 }
 }
 
 
+//同步
+const gdtb_onclick = async ()=>{
+  const WorkOrderDatada = await WorkOrderData();
+  console.log(WorkOrderDatada)
+  ElMessage({ type: 'warning',message: WorkOrderDatada.msg});
+}
+
 
 
 // =========== 查改U8工单 ===========
 // =========== 查改U8工单 ===========
 const cgugdlist = ref(false);
 const cgugdlist = ref(false);