|
|
@@ -11,7 +11,7 @@
|
|
|
<th style="width:40%;"><span>字段</span> </th>
|
|
|
<th><span>值</span></th>
|
|
|
</tr>
|
|
|
- <tr >
|
|
|
+ <tr>
|
|
|
<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>
|
|
|
</tr>
|
|
|
@@ -100,7 +100,7 @@
|
|
|
<table width="100%" border="1" class="new_craft" id="new_craft">
|
|
|
<caption>工艺</caption>
|
|
|
<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>
|
|
|
<input type="button" style="margin-left: 1px;" value="增加工艺" @click="addInput"/>
|
|
|
</td>
|
|
|
@@ -125,6 +125,7 @@
|
|
|
getDocumentData,
|
|
|
getDocumentHistory,
|
|
|
saveDocumentData,
|
|
|
+ getHistory,
|
|
|
getDocumentInfo
|
|
|
} from '@/api/mes/job'
|
|
|
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
|
|
|
@@ -156,160 +157,7 @@
|
|
|
const selectedPaper = ref([])
|
|
|
const selectedPeijian = 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= {
|
|
|
"panels": [
|
|
|
@@ -4166,6 +4014,224 @@
|
|
|
hiprint.init()
|
|
|
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>
|
|
|
|
|
|
<style>
|