baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+32444
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,297 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>采购物料交付计划看板</title>
|
||||
<!-- 公共侧边栏组件 -->
|
||||
<link rel="stylesheet" href="../common/nav.css">
|
||||
<style>
|
||||
*{margin:0;padding:0;box-sizing:border-box}
|
||||
body{font-family:'Microsoft YaHei','PingFang SC',sans-serif;background:#f0f2f5;min-height:100vh}
|
||||
.top-bar{background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff;padding:0 24px;display:flex;align-items:center;height:56px;box-shadow:0 2px 8px rgba(0,0,0,.15);position:sticky;top:0;z-index:100}
|
||||
.top-bar .logo{font-size:18px;font-weight:600;letter-spacing:1px;margin-right:32px}
|
||||
.top-bar .nav-tabs{display:flex;gap:4px;height:100%}
|
||||
.top-bar .nav-tabs a{color:rgba(255,255,255,.75);text-decoration:none;padding:0 16px;display:flex;align-items:center;font-size:13px;border-radius:4px 4px 0 0;transition:all .2s}
|
||||
.top-bar .nav-tabs a:hover{color:#fff;background:rgba(255,255,255,.1)}
|
||||
.top-bar .nav-tabs a.active{color:#fff;background:rgba(255,255,255,.2)}
|
||||
.top-bar .user-info{margin-left:auto;font-size:13px;opacity:.85}
|
||||
.main-container{max-width:1500px;margin:0 auto;padding:16px 20px}
|
||||
/* 统计卡片 */
|
||||
.stat-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}
|
||||
.stat-card{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:18px;text-align:center;border-top:3px solid #3b82f6}
|
||||
.stat-card .stat-value{font-size:32px;font-weight:700;margin-bottom:4px}
|
||||
.stat-card .stat-label{font-size:13px;color:#64748b}
|
||||
.stat-card.stat-danger{border-top-color:#ef4444}.stat-card.stat-danger .stat-value{color:#ef4444}
|
||||
.stat-card.stat-warning{border-top-color:#f59e0b}.stat-card.stat-warning .stat-value{color:#f59e0b}
|
||||
.stat-card.stat-safe{border-top-color:#22c55e}.stat-card.stat-safe .stat-value{color:#22c55e}
|
||||
.stat-card.stat-total{border-top-color:#3b82f6}.stat-card.stat-total .stat-value{color:#3b82f6}
|
||||
.panel{background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:16px;margin-bottom:14px}
|
||||
.panel h3{font-size:15px;color:#333;font-weight:600;margin-bottom:12px}
|
||||
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
|
||||
.toolbar select,.toolbar input{height:32px;padding:0 10px;border:2px solid #e0e0e0;border-radius:5px;font-size:13px;outline:none}
|
||||
.toolbar select:focus,.toolbar input:focus{border-color:#1a73e8}
|
||||
.btn{height:32px;padding:0 16px;border:none;border-radius:5px;font-size:12px;font-weight:600;cursor:pointer;transition:all .2s;color:#fff}
|
||||
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0)}
|
||||
.btn-primary:hover{opacity:.92}
|
||||
.btn-outline{background:#fff;color:#666;border:2px solid #e0e0e0}
|
||||
.btn-outline:hover{border-color:#1a73e8;color:#1a73e8}
|
||||
/* 分组列表 */
|
||||
.group-row{display:flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid #e2e8f0;border-radius:6px;margin-bottom:8px;cursor:pointer;background:#fff;transition:all .15s}
|
||||
.group-row:hover{background:#f0f6ff}
|
||||
.group-row .expand{font-size:12px;color:#1a73e8;width:16px}
|
||||
.group-row .group-name{font-weight:600;color:#333;min-width:150px}
|
||||
.group-row .group-sub{color:#64748b;font-size:13px;flex:1}
|
||||
.badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500}
|
||||
.badge-danger{background:#fee2e2;color:#991b1b}
|
||||
.badge-warning{background:#fef3c7;color:#92400e}
|
||||
.badge-success{background:#dcfce7;color:#166534}
|
||||
.badge-info{background:#dbeafe;color:#1e40af}
|
||||
table{width:100%;border-collapse:collapse;font-size:13px}
|
||||
thead th{background:#f8f9fa;color:#555;font-weight:600;padding:9px 12px;text-align:left;border:1px solid #999;border-bottom:2px solid #999;white-space:nowrap}
|
||||
tbody td{padding:9px 12px;border:1px solid #ddd;color:#333}
|
||||
tbody tr:hover{background:#f0f6ff}
|
||||
.pagination{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:12px;font-size:13px;color:#666}
|
||||
.pagination button{min-width:30px;height:30px;border:1px solid #e0e0e0;border-radius:4px;background:#fff;cursor:pointer}
|
||||
.pagination button.active{background:#1a73e8;color:#fff;border-color:#1a73e8}
|
||||
/* 甘特图 */
|
||||
.gantt-container{overflow-x:auto;margin-top:8px}
|
||||
.gantt-grid{display:grid;grid-template-columns:160px repeat(var(--gantt-cols),minmax(36px,1fr));gap:1px;font-size:11px;min-width:100%}
|
||||
.gantt-header{background:#f1f5f9;padding:6px 4px;text-align:center;font-weight:600;color:#64748b;border-bottom:2px solid #e2e8f0}
|
||||
.gantt-header.weekend{background:#e2e8f0;color:#94a3b8}
|
||||
.gantt-name{background:#f8fafc;padding:6px 8px;font-weight:500;border-bottom:1px solid #e2e8f0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.gantt-cell{padding:4px 2px;text-align:center;border-bottom:1px solid #e2e8f0;min-height:28px}
|
||||
.gantt-cell.req{background:#dbeafe;color:#1e40af;font-weight:600}
|
||||
.gantt-cell.arrival{background:#dcfce7;color:#166534}
|
||||
.gantt-cell.stop{background:#fee2e2;color:#991b1b}
|
||||
.gantt-cell.empty{background:#fff}
|
||||
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;box-shadow:0 4px 20px rgba(0,0,0,.15);display:none;min-width:240px;text-align:center}
|
||||
.toast.error{background:#fdeaea;color:#b71c1c;display:block}
|
||||
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
|
||||
.detail-wrap{display:none;margin-bottom:8px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sidebar"></div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="stat-cards">
|
||||
<div class="stat-card stat-total"><div class="stat-value" id="statTotal">0</div><div class="stat-label">物料总数</div></div>
|
||||
<div class="stat-card stat-danger"><div class="stat-value" id="statDanger">0</div><div class="stat-label">断线风险</div></div>
|
||||
<div class="stat-card stat-warning"><div class="stat-value" id="statWarn">0</div><div class="stat-label">预警关注</div></div>
|
||||
<div class="stat-card stat-safe"><div class="stat-value" id="statSafe">0</div><div class="stat-label">安全供应</div></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>物料交付分组(按产品)</h3>
|
||||
<div class="toolbar">
|
||||
<select id="selProductType" style="min-width:140px"><option value="">产品类型:全部</option></select>
|
||||
<select id="selRisk">
|
||||
<option value="">风险:全部</option>
|
||||
<option value="断线">断线</option>
|
||||
<option value="预警">预警</option>
|
||||
<option value="安全">安全</option>
|
||||
</select>
|
||||
<input type="text" id="txtKeyword" placeholder="物料编码/名称" style="min-width:160px">
|
||||
<div style="flex:1"></div>
|
||||
<button class="btn btn-outline" onclick="loadBoard()">刷新</button>
|
||||
</div>
|
||||
<div id="groupList"></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>物料交付明细</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>物料编码</th><th>物料名称</th><th>层级</th><th>产品类型</th><th>日需求</th><th>总需求</th>
|
||||
<th>可用库存</th><th>在途</th><th>已到货</th><th>预计停线日</th><th>预计到货日</th><th>风险</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbodyDetail"></tbody>
|
||||
</table>
|
||||
<div class="pagination" id="detailPagination"></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>交付甘特图(需求/到货)</h3>
|
||||
<div class="gantt-container">
|
||||
<div class="gantt-grid" id="ganttGrid"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
<script>
|
||||
var options=null;
|
||||
var currentProductType='';
|
||||
var currentRisk='';
|
||||
var ganttData=[];
|
||||
|
||||
function toast(msg,tp){var el=document.getElementById('toast');el.textContent=msg;el.className='toast '+tp;clearTimeout(el._timer);el._timer=setTimeout(function(){el.className='toast'},3000)}
|
||||
function api(url,method,data,cb){
|
||||
var opts={method:method||'GET',headers:{'Content-Type':'application/json'}};
|
||||
if(data)opts.body=JSON.stringify(data);
|
||||
fetch(url,opts).then(function(r){return r.json()}).then(function(res){
|
||||
if(res&&res.success===false){toast(res.message||'操作失败','error');return}
|
||||
cb&&cb(res);
|
||||
}).catch(function(e){toast('请求失败:'+e.message,'error')});
|
||||
}
|
||||
function getApiUrl(){return '../../api/deliver/'}
|
||||
|
||||
function loadOptions(cb){
|
||||
// 产品类型下拉:从分组接口取
|
||||
api(getApiUrl()+'GetBoardGroups','GET',null,function(res){
|
||||
var h='<option value="">产品类型:全部</option>';
|
||||
(res.data||[]).forEach(function(g){h+='<option value="'+g.ProductType+'">'+g.ProductType+'</option>'});
|
||||
document.getElementById('selProductType').innerHTML=h;
|
||||
cb&&cb();
|
||||
});
|
||||
}
|
||||
|
||||
function loadBoard(){
|
||||
currentProductType=document.getElementById('selProductType').value;
|
||||
currentRisk=document.getElementById('selRisk').value;
|
||||
loadStats();
|
||||
loadGroups();
|
||||
loadDetail();
|
||||
loadGantt();
|
||||
}
|
||||
|
||||
function loadStats(){
|
||||
api(getApiUrl()+'GetBoardStats?productType='+encodeURIComponent(currentProductType)+'&risk='+encodeURIComponent(currentRisk),'GET',null,function(res){
|
||||
var d=res.data||{};
|
||||
document.getElementById('statTotal').textContent=d.total||0;
|
||||
document.getElementById('statDanger').textContent=d.danger||0;
|
||||
document.getElementById('statWarn').textContent=d.warn||0;
|
||||
document.getElementById('statSafe').textContent=d.safe||0;
|
||||
});
|
||||
}
|
||||
|
||||
function loadGroups(){
|
||||
api(getApiUrl()+'GetBoardGroups','GET',null,function(res){
|
||||
var rows=res.data||[];
|
||||
var html='';
|
||||
if(rows.length===0)html='<div style="text-align:center;padding:30px;color:#bbb">暂无数据</div>';
|
||||
rows.forEach(function(g){
|
||||
var stClass=g.Status=='需处理'?'badge-danger':(g.Status=='关注'?'badge-warning':'badge-success');
|
||||
html+='<div class="group-row" onclick="toggleGroup(\''+g.ProductType+'\',this)">'+
|
||||
'<span class="expand">▶</span>'+
|
||||
'<span class="group-name">'+g.ProductType+'</span>'+
|
||||
'<span style="color:#64748b;font-size:13px">'+g.MaterialCount+'个物料</span>'+
|
||||
'<span class="badge badge-danger">断线'+g.DangerCount+'</span>'+
|
||||
'<span class="badge badge-warning">预警'+g.WarnCount+'</span>'+
|
||||
'<span class="badge '+stClass+'">'+g.Status+'</span>'+
|
||||
'</div>';
|
||||
});
|
||||
document.getElementById('groupList').innerHTML=html;
|
||||
});
|
||||
}
|
||||
|
||||
function toggleGroup(productType,el){
|
||||
currentProductType=productType;
|
||||
document.getElementById('selProductType').value=productType;
|
||||
var expand=el.querySelector('.expand');
|
||||
if(expand.textContent==='▶'){expand.textContent='▼'}else{expand.textContent='▶'}
|
||||
loadDetail();
|
||||
loadGantt();
|
||||
}
|
||||
|
||||
function loadDetail(page){
|
||||
page=page||1;
|
||||
var kw=document.getElementById('txtKeyword').value.trim();
|
||||
api(getApiUrl()+'GetBoardDetail?productType='+encodeURIComponent(currentProductType)+'&risk='+encodeURIComponent(currentRisk)+'&keyword='+encodeURIComponent(kw)+'&page='+page+'&pageSize=50','GET',null,function(res){
|
||||
var rows=res.data||[];
|
||||
var html='';
|
||||
if(rows.length===0)html='<tr><td colspan="12" style="text-align:center;padding:36px;color:#bbb">暂无明细数据</td></tr>';
|
||||
rows.forEach(function(r){
|
||||
var cls=r.DeliveryRisk=='断线'?'badge-danger':(r.DeliveryRisk=='预警'?'badge-warning':'badge-success');
|
||||
html+='<tr>'+
|
||||
'<td>'+r.ChildMaterialId+'</td>'+
|
||||
'<td>'+r.MaterialName+'</td>'+
|
||||
'<td>L'+r.BOMLevel+'</td>'+
|
||||
'<td>'+(r.ProductTypes||'')+'</td>'+
|
||||
'<td>'+r.DailyReq+'</td>'+
|
||||
'<td>'+r.TotalRequirement+'</td>'+
|
||||
'<td>'+r.AvailableStock+'</td>'+
|
||||
'<td>'+r.InTransitQty+'</td>'+
|
||||
'<td>'+r.ArrivedQty+'</td>'+
|
||||
'<td>'+r.ExpectedStopDate+'</td>'+
|
||||
'<td>'+r.ExpectedArrivalDate+'</td>'+
|
||||
'<td><span class="badge '+cls+'">'+r.DeliveryRisk+'</span></td>'+
|
||||
'</tr>';
|
||||
});
|
||||
document.getElementById('tbodyDetail').innerHTML=html;
|
||||
renderPagination(res.total,res.page);
|
||||
});
|
||||
}
|
||||
|
||||
function renderPagination(total,page){
|
||||
var pages=Math.ceil(total/50);
|
||||
if(pages<=1){document.getElementById('detailPagination').innerHTML='';return}
|
||||
var html='';
|
||||
for(var i=1;i<=pages;i++)html+='<button class="'+(i==page?'active':'')+'" onclick="loadDetail('+i+')">'+i+'</button>';
|
||||
document.getElementById('detailPagination').innerHTML=html;
|
||||
}
|
||||
|
||||
function loadGantt(){
|
||||
api(getApiUrl()+'GetGanttData?productType='+encodeURIComponent(currentProductType)+'&risk=断线,预警','GET',null,function(res){
|
||||
ganttData=res.data||[];
|
||||
var start=res.startDate;
|
||||
var end=res.endDate;
|
||||
if(!start||!end){document.getElementById('ganttGrid').innerHTML='<div style="padding:20px;color:#bbb">暂无排程数据</div>';return}
|
||||
renderGantt(start,end,ganttData);
|
||||
});
|
||||
}
|
||||
|
||||
function renderGantt(start,end,data){
|
||||
var dates=[];
|
||||
var cur=new Date(start),last=new Date(end);
|
||||
while(cur<=last){dates.push(formatDate(cur));cur.setDate(cur.getDate()+1)}
|
||||
document.getElementById('ganttGrid').style.setProperty('--gantt-cols',dates.length);
|
||||
|
||||
// 按物料分组
|
||||
var groups={};
|
||||
data.forEach(function(d){
|
||||
var key=d.ChildMaterialId;
|
||||
if(!groups[key])groups[key]={material:d.ChildMaterialId,name:d.MaterialName,risk:d.DeliveryRisk,stop:d.ExpectedStopDate,reqs:{},arrivals:[]};
|
||||
if(d.PlanDate)groups[key].reqs[d.PlanDate]=(groups[key].reqs[d.PlanDate]||0)+(parseFloat(d.DailyRequirement)||0);
|
||||
if(d.ArrivalExpectedDate||d.ActualArrivalDate)groups[key].arrivals.push(d);
|
||||
});
|
||||
|
||||
// 表头
|
||||
var html='<div class="gantt-header" style="grid-column:1">物料</div>';
|
||||
dates.forEach(function(d){
|
||||
var dt=new Date(d);var wk=['日','一','二','三','四','五','六'][dt.getDay()];
|
||||
var isWk=(dt.getDay()==0||dt.getDay()==6);
|
||||
html+='<div class="gantt-header'+(isWk?' weekend':'')+'">'+(d.slice(5))+'<br>周'+wk+'</div>';
|
||||
});
|
||||
|
||||
// 物料行
|
||||
Object.keys(groups).forEach(function(key){
|
||||
var g=groups[key];
|
||||
html+='<div class="gantt-name" title="'+g.name+'">'+g.material+' <span style="color:#94a3b8">L'+(key.split('|')[0]||'')+'</span></div>';
|
||||
dates.forEach(function(d){
|
||||
var cls='empty';
|
||||
var txt='';
|
||||
if(g.stop==d){cls='stop';txt='停'}
|
||||
if(g.reqs[d]){cls=cls=='stop'?'stop':'req';txt=(txt||'')+(g.reqs[d]||'')}
|
||||
// 到货
|
||||
g.arrivals.forEach(function(a){
|
||||
var ad=a.ArrivalExpectedDate;
|
||||
if(ad==d){cls='arrival';txt=(txt||'')+'>'+a.ArrivalQty}
|
||||
});
|
||||
html+='<div class="gantt-cell '+cls+'">'+txt+'</div>';
|
||||
});
|
||||
});
|
||||
document.getElementById('ganttGrid').innerHTML=html;
|
||||
}
|
||||
|
||||
function formatDate(d){var y=d.getFullYear(),m=('0'+(d.getMonth()+1)).slice(-2),dd=('0'+d.getDate()).slice(-2);return y+'-'+m+'-'+dd}
|
||||
|
||||
loadOptions(function(){loadBoard()});
|
||||
</script>
|
||||
<!-- 公共导航栏组件(菜单维护点:View/common/nav.js) -->
|
||||
<script src="../common/nav.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+1011
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user