import{d as e,o as t,r as a,u as l,j as o,x as n,b as s,c as u,w as c,k as r,m as p,h as v,q as i,B as d,i as m}from"./index-z4UiUMlV.js";import{_ as f}from"./cshaptx4869-scancode.CCmqBnEF.js";import{r as h}from"./uni-app.es.DihD-zYh.js";import{g as w,b as x,a as b,s as y}from"./index.Wwo-uIrA.js";import{_ as g}from"./_plugin-vue_export-helper.BCo6x5W8.js";const _=g(e({__name:"w-scanCode",setup(e){t((()=>{}));const g=a({});l(g.value,(()=>{if(g.value.shelve&&g.value.column&&g.value.row){let e=g.value.shelve+"-"+g.value.column+"-"+g.value.row;w("/shelves/isActive?code="+e).then((t=>{200===t.code&&(t.data.active?V.value=e:x({title:"该库位码已被禁用，请联系管理员"}).then((()=>{})))}))}}));const _=()=>{window.history.back()},T=a(),z=a(),V=a(),$=()=>{T.value="location",k()},C=()=>{T.value="barcode",k()},F=a(!1);function k(){F.value=!0}function j(e){if(F.value=!1,"location"==T.value){let t=e.split("-");g.value.shelve=t[0],g.value.column=t[1],g.value.row=t[2]}else"barcode"==T.value&&(z.value=e,b("/rawFabric/sign",{barcode:z.value,location:V.value},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{if(7778===e.code){let t=JSON.parse(e.msg);if(t.location==V.value)y({message:"该面料已放置在"+t.location+"，请勿重复扫码",allowHtml:!0,confirmButtonText:"扫一扫"}).then((()=>{k()})).catch((()=>{g.value.shelve="",g.value.column="",g.value.row="",V.value="",z.value=""}));else{let e=`\n\t\t\t\t\t\t\t\t\t\t\t<div style="text-align: left">\n\t\t\t\t\t\t\t\t\t\t\t<p>面料编号：<span style="color:red;font-size:18px">${z.value}</span></p>\n\t\t\t\t\t\t\t\t\t\t\t<p>面料名称：<span style="color:red;font-size:18px">${t.category}</span></p>\n\t\t\t\t\t\t\t\t\t\t\t<p>面料位置：<span style="color:red;font-size:18px">${t.location}</span></p>\n\t\t\t\t\t\t\t\t\t\t\t<p style="margin-top:8px">是否将面料移动到<span style="color:red;font-size:18px">${V.value}</span>？</p>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t`;y({title:"扫码成功！",message:e,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{b("/rawFabric/sign",{barcode:z.value,location:V.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?i("入货架成功！"):i(e.msg)}))})).catch((()=>{g.value.shelve="",g.value.column="",g.value.row="",V.value="",z.value=""}))}}else if(7777===e.code){let t=JSON.parse(e.msg),a=`\n\t\t\t\t\t<p>面料编号为<span style="color:red;font-size:18px">${z.value}</span>的<span style="color:red;font-size:18px">${t.category}</span>被暂存在检验室，是否确认移动到<span style="color:red;font-size:18px">${V.value}</span>？</p>\n\t\t\t  `;y({message:a,allowHtml:!0,confirmButtonText:"确认"}).then((()=>{b("/rawFabric/sign",{barcode:z.value,location:V.value,force:!0},{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}).then((e=>{200===e.code?i("入货架成功！"):i(e.msg)}))})).catch((()=>{g.value.shelve="",g.value.column="",g.value.row="",V.value="",z.value=""}))}else if(200===e.code){let t=`\n\t\t\t\t\t<p>面料编号：<span style="color:red;font-size:18px">${z.value}</span></p>\n\t\t\t\t\t<p>面料名称：<span style="color:red;font-size:18px">${e.data}</span></p>\n\t\t\t\t\t`;y({title:"扫码成功！",message:t,allowHtml:!0,confirmButtonText:"扫一扫"}).then((()=>{k()})).catch((()=>{g.value.shelve="",g.value.column="",g.value.row="",V.value="",z.value=""}))}else i(e.msg)})))}function U(e){d({title:e.errName,content:e.errMsg,complete:()=>{F.value=!1}})}function B(){F.value=!1}return(e,t)=>{const a=o("van-nav-bar"),l=m,i=o("van-field"),d=h(n("cshaptx4869-scancode"),f);return s(),u(l,{class:"flex"},{default:c((()=>[r(a,{title:"扫码入库","left-text":"返回","left-arrow":"",onClickLeft:_}),r(l,{class:"btn",onClick:$},{default:c((()=>[p("扫描库位码")])),_:1}),r(l,{style:{margin:"20rpx 50rpx"}},{default:c((()=>[r(i,{name:"当前库位码",label:"当前库位码",colon:"","label-width":"6em"},{input:c((()=>[r(i,{modelValue:g.value.shelve,"onUpdate:modelValue":t[0]||(t[0]=e=>g.value.shelve=e),class:"bor-a",type:"number"},null,8,["modelValue"]),p("— "),r(i,{modelValue:g.value.column,"onUpdate:modelValue":t[1]||(t[1]=e=>g.value.column=e),class:"bor-a",type:"number"},null,8,["modelValue"]),p("— "),r(i,{modelValue:g.value.row,"onUpdate:modelValue":t[2]||(t[2]=e=>g.value.row=e),class:"bor-a",type:"number"},null,8,["modelValue"])])),_:1})])),_:1}),V.value?(s(),u(l,{key:0,class:"btn",onClick:C},{default:c((()=>[p("扫描面料编号")])),_:1})):v("",!0),F.value?(s(),u(d,{key:1,onSuccess:j,onFail:U,onClose:B})):v("",!0)])),_:1})}}}),[["__scopeId","data-v-4b187a99"]]);export{_ as default};
