Files
bj_power/bj_power_mes/public/assets_bak_1791615921/MaterialRequest-GcHfVHHu.js
T
SunYF 8be6e03a15 docs: 统一修正全项目“SN管理”相关术语为“序列号”
本次 commit 统一修正了全项目范围内关于 SN 管理的术语表述,将原“SN管理”、“序列号件”、“批次件”等表述调整为“序列号”、“序列号=是”、“序列号=否”,同时同步更新了相关文档、代码注释、前端提示文本、数据库 schema 注释、API 文档等,确保全链路术语统一,消除理解歧义。
2026-10-10 15:58:59 +08:00

8 lines
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{o as ue,c as U,b as e,w as o,l as j,F as de,m as P,j as x,r as u,k as w,e as f,i as V,h as s,q as N,t as G,v as d,f as m,B as Y,E as C,z as Q}from"./index-CZ641VGk.js";import{c as pe}from"./confirm-CJ7eoQqS.js";import{c as A}from"./perm-DCTK2KrM.js";import{c as me,P as ce}from"./help-D7sbn63X.js";const fe={style:{padding:"8px 16px"}},ye={style:{"font-weight":"600","margin-bottom":"6px"}},be={key:1,style:{color:"#909399","font-size":"12px",padding:"6px 0"}},ge={key:1},Ne={style:{"margin-top":"10px","text-align":"right"}},xe={__name:"MaterialRequest",setup(_e){const r=P({planDate:"",orderNo:"",status:"",materialCode:"",materialName:"",targetDock:"",stationNo:"",source:""});function H(){r.planDate=new Date().toISOString().slice(0,10),Object.assign(r,{orderNo:"",status:"",materialCode:"",materialName:"",targetDock:"",stationNo:"",source:""}),p()}const B=w([]),M=w(!1),O=w(""),z=w(!1),L=w(!1),K=w(!1),E=w([]),F=l=>l==="PENDING"?"待备料":l==="LOCKED"?"已备料(已出库)":l==="DELIVERING"?"配送中":l==="DONE"?"已接料完结":l;function D(l){const t=Number(l||0);return Number.isInteger(t)?String(t):t.toFixed(2)}function J(l){const t=Number(l.reqQty||0),c=Number(l.receivedQty||0);return t<=0?0:Math.min(100,Math.round(c/t*100))}const h=P({});function q(l){return Number(l.receivedQty||0)-Number(l.consumedQty||0)-Number(l.returnedQty||0)}function S(l){return Number(l.netOut??Number(l.outQty||0)-Number(l.returnedQty||0))>Number(l.totalQty||0)?{key:"over",label:"超领",type:"danger"}:l.status==="领料完结"&&q(l)>0?{key:"left",label:"完结剩料",type:"warning"}:Number(l.inTransit||0)>0?{key:"transit",label:"在途等待",type:"warning"}:{key:"ok",label:"正常",type:"success"}}function X(l){const t=S(l);return t.key==="over"?"净领用超过工单需求:请到 WMS「出库管理」按工单号查超领原因与明细":t.key==="left"?"台账已领料完结,但工位仍压料未消耗也未退回:请催报工或发起退料":t.key==="transit"?"已发出尚未接料(含已送达未扫码):请到 WMS「出库管理」看是否已送达,或催工位扫码接料":"在库 / 在途 / 线边 / 已消耗均在正常区间"}async function Z(l,t){var b;const c=l.rowKey;if(!(!t.some(i=>i.rowKey===c)||(b=h[c])!=null&&b.loaded)){h[c]={loaded:!1,receives:[]};try{const g=(await x.get("/material-requests",{params:{orderNo:l.orderNo}})||[]).filter(y=>y.materialCode===l.materialCode);h[c]={loaded:!0,receives:g}}catch{h[c]={loaded:!0,receives:[]}}}}async function ee(){if(!await pe(E.value.length,"物料去向对账记录"))return;const t=[["工单号","图号","物料名称","目标工位","需求","已发出","已退回","已接料","已消耗","在途","工位余","待发缺口","对账状态","台账状态"].join(",")];for(const i of E.value){const g=[i.orderNo,i.materialCode,i.materialName,i.targetStation,i.totalQty,i.outQty,i.returnedQty,i.receivedQty,i.consumedQty,i.inTransit,q(i),i.gap,S(i).label,i.status];t.push(g.map(y=>'"'+String(y??"").replace(/"/g,'""')+'"').join(","))}const c=new Blob(["\uFEFF"+t.join(`\r
`)],{type:"text/csv;charset=utf-8"}),b=document.createElement("a");b.href=URL.createObjectURL(c),b.download="物料去向对账.csv",b.click(),URL.revokeObjectURL(b.href)}async function te(){L.value=!0;try{const l=await x.get("/material-requests/progress",{params:{orderNo:r.orderNo,materialCode:r.materialCode,page:1,pageSize:100}});E.value=((l==null?void 0:l.list)||[]).map(t=>({...t,rowKey:t.orderNo+"|"+t.materialCode})),K.value=!0}catch{}L.value=!1}async function p(){B.value=await x.get("/material-requests",{params:r})||[]}async function le(l){if(l!=null&&l.requestNo){try{await Q.confirm(`确认「${l.requestNo}」已接料(物料将累计到已发料,达需求即完结)?`,"接料确认",{type:"warning"})}catch{return}M.value=!0,O.value=l.requestNo;try{await x.post("/material-requests/receive",{requestNo:l.requestNo}),C.success("已接料确认:"+l.requestNo),p()}catch{}M.value=!1,O.value=""}}async function ae(){if(!r.planDate)return C.warning("请先选择排产日期");await Q.confirm(`将按排产日期 ${r.planDate} 的所有工单,根据各产品物料清单自动计算所需物料并生成备料单。确认继续?`,"生成备料",{type:"info"});const l=await x.post("/material-requests/generate",{planDate:r.planDate});if(l!=null&&l.blocked){const t=(l.missing||[]).join("、");await Q.alert(`以下物料在 WMS 物料档案中不存在,请先到 WMS 创建物料档案后再生成备料单:
${t}`,"无法生成备料单",{type:"error",confirmButtonText:"知道了"});return}C.success(`已生成 ${(l==null?void 0:l.count)||0} 条备料`),p()}async function oe(){if(!r.planDate&&!r.orderNo)return C.warning("请先选择排产日期或填写工单号");try{await Q.confirm(`将对 ${r.orderNo?"工单 "+r.orderNo:"排产日期 "+r.planDate} 下未出齐的备料单,按 FIFO 从 WMS 合格库存自动领料出库。确认继续?`,"一键自动出库",{type:"warning"})}catch{return}z.value=!0;try{const l=await x.post("/material-requests/auto-outbound",{planDate:r.planDate,orderNo:r.orderNo}),t=(l==null?void 0:l.short)||[];t.length?await Q.alert(`已出库达标 ${(l==null?void 0:l.done)||0} 条;以下仍未出齐(库存不足,等补货后可再次执行):
${t.join(`
`)}`,"自动出库结果",{type:"warning",confirmButtonText:"知道了"}):C.success(`自动出库完成:${(l==null?void 0:l.done)||0} 条已备料`),p()}catch{}z.value=!1}return ue(()=>{r.planDate=new Date().toISOString().slice(0,10),p()}),(l,t)=>{const c=u("el-alert"),b=u("el-date-picker"),i=u("el-form-item"),g=u("el-input"),y=u("el-option"),T=u("el-select"),_=u("el-button"),ne=u("el-form"),n=u("el-table-column"),k=u("el-tag"),re=u("el-progress"),$=u("el-tooltip"),I=u("el-table"),ie=u("el-card"),se=u("el-dialog");return f(),U(de,null,[e(ie,null,{default:o(()=>[e(c,{type:"info",closable:!1,style:{"margin-bottom":"12px"},title:"备料单:根据「日排产」自动算出某天要生产的所有工单所需物料。选好排产日期后点「按日排产生成备料」,系统按各产品物料清单(单台用量×计划数量×(1+损耗率))自动汇总生成备料单,仓库据此备料出库。"}),e(ne,{inline:""},{default:o(()=>[e(i,{label:"日期"},{default:o(()=>[e(b,{modelValue:r.planDate,"onUpdate:modelValue":t[0]||(t[0]=a=>r.planDate=a),type:"date","value-format":"YYYY-MM-DD",onChange:p},null,8,["modelValue"])]),_:1}),e(i,{label:"工单号"},{default:o(()=>[e(g,{modelValue:r.orderNo,"onUpdate:modelValue":t[1]||(t[1]=a=>r.orderNo=a),clearable:"",style:{width:"160px"},onKeyup:V(p,["enter"])},null,8,["modelValue"])]),_:1}),e(i,{label:"图号"},{default:o(()=>[e(g,{modelValue:r.materialCode,"onUpdate:modelValue":t[2]||(t[2]=a=>r.materialCode=a),clearable:"",style:{width:"150px"},placeholder:"不区分大小写",onKeyup:V(p,["enter"])},null,8,["modelValue"])]),_:1}),e(i,{label:"物料名称"},{default:o(()=>[e(g,{modelValue:r.materialName,"onUpdate:modelValue":t[3]||(t[3]=a=>r.materialName=a),clearable:"",style:{width:"150px"},onKeyup:V(p,["enter"])},null,8,["modelValue"])]),_:1}),e(i,{label:"接驳台"},{default:o(()=>[e(g,{modelValue:r.targetDock,"onUpdate:modelValue":t[4]||(t[4]=a=>r.targetDock=a),clearable:"",style:{width:"120px"},placeholder:"如 DOCK05",onKeyup:V(p,["enter"])},null,8,["modelValue"])]),_:1}),e(i,{label:"工位"},{default:o(()=>[e(g,{modelValue:r.stationNo,"onUpdate:modelValue":t[5]||(t[5]=a=>r.stationNo=a),clearable:"",style:{width:"90px"},placeholder:"如 3",onKeyup:V(p,["enter"])},null,8,["modelValue"])]),_:1}),e(i,{label:"来源"},{default:o(()=>[e(T,{modelValue:r.source,"onUpdate:modelValue":t[6]||(t[6]=a=>r.source=a),clearable:"",placeholder:"全部",style:{width:"120px"}},{default:o(()=>[e(y,{label:"排产备料",value:"PLAN"}),e(y,{label:"工位补料",value:"REFILL"})]),_:1},8,["modelValue"])]),_:1}),e(i,{label:"状态"},{default:o(()=>[e(T,{modelValue:r.status,"onUpdate:modelValue":t[7]||(t[7]=a=>r.status=a),clearable:"",placeholder:"全部",style:{width:"130px"}},{default:o(()=>[e(y,{label:"待备料",value:"PENDING"}),e(y,{label:"已备料(已出库)",value:"LOCKED"}),e(y,{label:"配送中",value:"DELIVERING"}),e(y,{label:"已接料完结",value:"DONE"})]),_:1},8,["modelValue"])]),_:1}),e(i,null,{default:o(()=>[e(_,{type:"primary",onClick:p},{default:o(()=>[...t[9]||(t[9]=[s("查询",-1)])]),_:1}),e(_,{onClick:H},{default:o(()=>[...t[10]||(t[10]=[s("重置",-1)])]),_:1}),j(A)("produce.material:generate")?(f(),N(_,{key:0,type:"success",onClick:ae},{default:o(()=>[...t[11]||(t[11]=[s("按日排产生成备料",-1)])]),_:1})):G("",!0),j(A)("produce.material:outbound")?(f(),N(_,{key:1,type:"warning",plain:"",loading:z.value,onClick:oe},{default:o(()=>[...t[12]||(t[12]=[s("一键自动出库",-1)])]),_:1},8,["loading"])):G("",!0),e(_,{type:"info",plain:"",loading:L.value,onClick:te},{default:o(()=>[...t[13]||(t[13]=[s("物料去向对账",-1)])]),_:1},8,["loading"])]),_:1})]),_:1}),e(I,{data:B.value,border:"",size:"small"},{default:o(()=>[e(n,{prop:"requestNo",label:"备料单号","min-width":"180"}),e(n,{prop:"orderNo",label:"工单号","min-width":"130"}),e(n,{prop:"planDate",label:"排产日期",width:"110"}),e(n,{label:"来源",width:"95",align:"center"},{default:o(({row:a})=>[a.source==="REFILL"?(f(),N(k,{key:0,type:"danger",size:"small"},{default:o(()=>[...t[14]||(t[14]=[s("工位补料",-1)])]),_:1})):(f(),N(k,{key:1,type:"info",size:"small"},{default:o(()=>[...t[15]||(t[15]=[s("排产备料",-1)])]),_:1}))]),_:1}),e(n,{prop:"materialCode",label:"图号","min-width":"110"}),e(n,{prop:"materialName",label:"物料名称","min-width":"110","show-overflow-tooltip":""}),e(n,{prop:"unit",label:"单位",width:"70"}),e(n,{label:"管理方式",width:"100"},{default:o(({row:a})=>[s(d(a.snMode===1?"序列号=是":"序列号=否"),1)]),_:1}),e(n,{prop:"stationNo",label:"工位",width:"70",align:"center"}),e(n,{prop:"targetDock",label:"接驳台",width:"100",align:"center"}),e(n,{prop:"batchNo",label:"批次",width:"120",align:"center","show-overflow-tooltip":""}),e(n,{prop:"reqQty",label:"需求数量",width:"90",align:"center"}),e(n,{label:"已发出",width:"90",align:"center"},{default:o(({row:a})=>[s(d(D(a.sentQty)),1)]),_:1}),e(n,{label:"已接料",width:"90",align:"center"},{default:o(({row:a})=>[s(d(Number(a.sentQty||0)>0?D(a.receivedQty):"—"),1)]),_:1}),e(n,{label:"分批进度","min-width":"150"},{default:o(({row:a})=>[e(re,{percentage:J(a),status:a.status==="DONE"?"success":""},null,8,["percentage","status"])]),_:1}),e(n,{prop:"status",label:"状态",width:"100"},{default:o(({row:a})=>[s(d(F(a.status)),1)]),_:1}),e(n,{label:"操作",width:"100",align:"center",fixed:"right"},{default:o(({row:a})=>[e($,{content:"仓库发出后才能确认接料",disabled:Number(a.sentQty||0)>0,placement:"top"},{default:o(()=>[e(_,{size:"small",type:"success",disabled:a.status==="DONE"||Number(a.sentQty||0)<=0,loading:M.value&&O.value===a.requestNo,onClick:R=>le(a)},{default:o(()=>[...t[16]||(t[16]=[s("确认接料",-1)])]),_:1},8,["disabled","loading","onClick"])]),_:2},1032,["disabled"])]),_:1}),e(n,{prop:"operator",label:"操作人",width:"90"})]),_:1},8,["data"])]),_:1}),e(se,{modelValue:K.value,"onUpdate:modelValue":t[8]||(t[8]=a=>K.value=a),title:"物料去向对账(在库 / 在途 / 线边 / 已消耗)",width:"1060px",top:"5vh"},{default:o(()=>[e(I,{data:E.value,border:"",size:"small","max-height":"560","row-key":"rowKey",onExpandChange:Z},{default:o(()=>[e(n,{type:"expand"},{default:o(({row:a})=>{var R,W;return[m("div",fe,[m("div",ye,"接料明细(按备料单,"+d(a.orderNo)+" / "+d(a.materialCode)+")",1),(R=h[a.rowKey])!=null&&R.loaded?(f(),N(I,{key:0,data:((W=h[a.rowKey])==null?void 0:W.receives)||[],border:"",size:"small","max-height":"220"},{default:o(()=>[e(n,{prop:"requestNo",label:"备料单号","min-width":"180"}),e(n,{label:"来源",width:"95",align:"center"},{default:o(({row:v})=>[v.source==="REFILL"?(f(),N(k,{key:0,type:"danger",size:"small"},{default:o(()=>[...t[17]||(t[17]=[s("工位补料",-1)])]),_:1})):(f(),N(k,{key:1,type:"info",size:"small"},{default:o(()=>[...t[18]||(t[18]=[s("排产备料",-1)])]),_:1}))]),_:1}),e(n,{prop:"stationNo",label:"工位",width:"70",align:"center"}),e(n,{label:"已发出",width:"85",align:"center"},{default:o(({row:v})=>[s(d(D(v.sentQty)),1)]),_:1}),e(n,{label:"已接料",width:"85",align:"center"},{default:o(({row:v})=>[s(d(D(v.receivedQty)),1)]),_:1}),e(n,{prop:"status",label:"状态",width:"100"},{default:o(({row:v})=>[s(d(F(v.status)),1)]),_:1}),e(n,{prop:"operator",label:"接料确认人",width:"100"})]),_:1},8,["data"])):(f(),U("div",be,"加载中…")),t[19]||(t[19]=m("div",{style:{color:"#909399","font-size":"12px","margin-top":"8px"}}," 消耗明细:已消耗量由 WMS 报工反冲核销(台账「已消耗」列),按工位合计的留痕在 WMS 操作日志按工单号查询;出库明细与超领原因在 WMS「出库管理」按工单号查询——本页不做跨系统重复建设。 ",-1))])]}),_:1}),e(n,{prop:"orderNo",label:"工单号","min-width":"130"}),e(n,{prop:"materialCode",label:"图号","min-width":"110"}),e(n,{prop:"materialName",label:"物料名称","min-width":"110","show-overflow-tooltip":""}),e(n,{prop:"targetStation",label:"目标工位",width:"80",align:"center"}),e(n,{prop:"totalQty",label:"需求",width:"70",align:"center"}),e(n,{prop:"outQty",label:"已发出",width:"75",align:"center"}),e(n,{prop:"returnedQty",label:"已退回",width:"75",align:"center"}),e(n,{label:"已接料",width:"75",align:"center"},{default:o(({row:a})=>[s(d(Number(a.outQty||0)>0?D(a.receivedQty):"—"),1)]),_:1}),e(n,{prop:"consumedQty",label:"已消耗",width:"75",align:"center"}),e(n,{label:"在途",width:"70",align:"center"},{default:o(({row:a})=>[m("span",{style:Y(a.inTransit>0?"color:#E6A23C;font-weight:600":"")},d(a.inTransit),5)]),_:1}),e(n,{label:"工位余",width:"70",align:"center"},{default:o(({row:a})=>[m("span",{style:Y(q(a)>0?"color:#E6A23C;font-weight:600":"")},d(q(a)),5)]),_:1}),e(n,{prop:"gap",label:"待发缺口",width:"85",align:"center"},{default:o(({row:a})=>[a.gap>0?(f(),N(k,{key:0,type:"danger",size:"small"},{default:o(()=>[s(d(a.gap),1)]),_:2},1024)):(f(),U("span",ge,"0"))]),_:1}),e(n,{label:"对账状态",width:"100",align:"center",fixed:"right"},{default:o(({row:a})=>[e($,{content:X(a),placement:"top"},{default:o(()=>[e(k,{type:S(a).type,size:"small"},{default:o(()=>[s(d(S(a).label),1)]),_:2},1032,["type"])]),_:2},1032,["content"])]),_:1})]),_:1},8,["data"]),t[21]||(t[21]=m("div",{style:{color:"#909399","font-size":"12px","margin-top":"8px"}},[s(" 口径:净领用 = 已发出 − 已退回;在途 = 已发出 − 已接料;工位余 = 已接料 − 已消耗 − 已退回;恒等式:入库总量 = 在库 + 在途 + 工位余 + 已消耗 + 退库回仓 + 盘点差异。 异常判定只标三类硬异常:"),m("b",null,"超领"),s("(净领用 > 需求)、"),m("b",null,"完结剩料"),s("(台账领料完结但工位仍压料)、"),m("b",null,"在途等待"),s("(已发出未接料,含已送达未扫码);生产中的待发缺口属正常状态,不标色。 "),m("br"),s("注:「已接料」为"),m("b",null,"本工单+图号的累计接料量"),s("(MES 按工单汇总,不细分到每行),并非本行发出对应的接料;某行「已发出」为 0 时该列显示「—」,详情见上方接料明细。 ")],-1)),m("div",Ne,[e(_,{size:"small",onClick:ee},{default:o(()=>[...t[20]||(t[20]=[s("导出 CSV",-1)])]),_:1})])]),_:1},8,["modelValue"]),e(ce,{data:j(me),page:"MaterialRequest"},null,8,["data"])],64)}}};export{xe as default};