<!doctype html>
|
<html>
|
|
<head>
|
<meta charset="UTF-8">
|
<title>采购入库</title>
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<!-- <link rel="stylesheet" href="../../lib/base_js/css/common.css" /> -->
|
|
<script type="text/javascript" src="../../lib/easyui/js/jquery.easyui.min.js" ></script>
|
<script src="../../lib/mui/js/mui.min.js"></script>
|
<link href="../../lib/mui/css/mui.min.css" rel="stylesheet" />
|
<link href="../../lib/mui/css/mui.picker.min.css" rel="stylesheet" />
|
<link href="../../lib/mui/css/mui.poppicker.css" rel="stylesheet" />
|
<script src="../../lib/mui/js/mui.picker.min.js"></script>
|
<script src="../../lib/mui/js/mui.poppicker.js"></script>
|
<!--<script type="text/SetInputFoucsjavascript" src="../../lib/base_js/js/common.js" ></script>-->
|
<script type="text/javascript" src="../../lib/base_js/js/app.js"></script>
|
|
<script type="text/javascript" src="../../lib/base_js/js/common.js" ></script>
|
|
<link rel="stylesheet" href="../../lib/base_js/css/common.css" />
|
<style>
|
#info {
|
/*查询信息属性*/
|
background-color: #FFE48D;
|
}
|
</style>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<link href="../../lib/mui/css/mui.min.css" rel="stylesheet">
|
|
<script src="../../lib/mui/js/mui.min.js"></script>
|
|
|
|
</head>
|
|
<body>
|
<div class="mui-input-group mui-content" onclick="SetInputFoucs('#DAB001')">
|
<!-- <div class="mui-input-row ">
|
<div style=" float: left; ">
|
<label class="row-title">人员</label>
|
<input class="row-content-split" type="text" name="txtBillNo" id="txtBillNo" placeholder="请选择报工人员"readonly="readonly">
|
</div>
|
</div> -->
|
|
<div class="mui-input-row" id="row001">
|
<label>发货通知单</label>
|
<select id="order" class="mui-h5 " style="margin:auto; color:#000;" >
|
<option value="">请点击选择工单</option>
|
</select>
|
</div>
|
<div class=" mui-input-row" id="row002">
|
<label>条码</label>
|
<input id="DAB001" type="text" value="" class="mui-input-clear text-color" placeholder="请扫描条码"
|
onkeypress="GetBarInfo()" />
|
</div>
|
<div id="txtInfo"><!--<div class="mui-input-row" style="height: 350px; margin-top: 10px;">-->
|
<div class="link-area" id="div001">
|
<h4 style="color: #008000; text-align: center;">
|
待出库单据明细
|
<span id="dgWOMDAG-sum" class="mui-badge mui-badge-success easyui-draggable"
|
style="font-size: 15px;" data-options="onStopDrag:onStopDrag">0</span>
|
</h4>
|
</div>
|
</div>
|
<div class="data-table-container" style="height: 100%; width: 100%;">
|
<table class="data-table" id="myTable" style="height: 100%; width: 100%;">
|
<!-- 表格代码 -->
|
<table class="data-table" id="myTable" style="height:100% width: 100%;;">
|
<thead>
|
<tr>
|
<th style="width: 100px;">物料名称</th>
|
<th>物料代码</th>
|
<th>待发数量</th>
|
<th>已发数量</th>
|
<th>推荐仓位</th>
|
<th>规格型号</th>
|
<th>图号</th>
|
</tr>
|
</thead>
|
<tbody>
|
<!-- 表格内容将通过 JS 动态生成 -->
|
</tbody>
|
</table>
|
</table>
|
</div>
|
|
|
</div>
|
|
</body>
|
|
</html>
|
|
<script>
|
|
mui.init(); // 初始化 MUI
|
//初始化
|
mui.ready(function() {
|
fetchData();
|
});
|
|
//获取发货通知单
|
function fetchData() {
|
mui.ajax({
|
url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFA",
|
type: "GET",
|
dataType: "json",
|
success: function(response) {
|
if (response.status === 0) {
|
var selectElement = document.getElementById('order');
|
selectElement.innerHTML = "";
|
var options = response.data.DFA001;
|
|
for (var i = 0; i < options.length; i++) {
|
var option = document.createElement("option");
|
option.value = options[i]+'--'+response.data.DFB002[i];
|
option.text = options[i]+'--'+response.data.DFB002[i];
|
selectElement.appendChild(option);
|
}
|
|
} else {
|
alert("获取数据异常:" + response.message);
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
mui.toast("获取数据异常:" + JSON.stringify(errorThrown));
|
alert("获取数据异常:");
|
}
|
});
|
}
|
|
document.getElementById('order').addEventListener('change', function() {
|
// 获取选中的值
|
var selectedValue = this.value;
|
console.log(selectedValue);
|
var splitValues = selectedValue.split("--");
|
|
if (splitValues.length === 2) {
|
var DFA001 = splitValues[0]; // 第一个值存入 DFA001
|
var DFB002 = splitValues[1]; // 第二个值存入 DFB002
|
}
|
|
// 发起 AJAX 请求
|
mui.ajax({
|
url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFB", // 后台接口的URL
|
type: 'POST', // 请求方法
|
data: {
|
DFA001: DFA001,
|
DFB002: DFB002, //获取复选框是否被选中(true,false)
|
}, // 请求参数,根据后台接口的要求进行修改
|
dataType: 'json', // 接收到的数据类型
|
success: function(response) {
|
// 处理成功响应
|
console.log(response); // 输出响应数据,你可以根据实际接口返回的数据进行相应的处理
|
|
if (response.status === 0) {
|
// 表格数据获取成功
|
var data = response.data;
|
var tableBody = document.querySelector("#myTable tbody");
|
tableBody.innerHTML = ""; // 清空表格内容
|
|
for (var i = 0; i < data.物料名称.length; i++) {
|
// 创建新的表格行
|
var newRow = document.createElement("tr");
|
|
// 创建并设置物料名称单元格
|
var nameCell = document.createElement("td");
|
nameCell.innerText = data.物料名称[i];
|
newRow.appendChild(nameCell);
|
|
// 创建并设置物料代码单元格
|
var codeCell = document.createElement("td");
|
codeCell.innerText = data.物料代码[i];
|
newRow.appendChild(codeCell);
|
|
// 创建并设置代发数量单元格
|
var pendingCell = document.createElement("td");
|
pendingCell.innerText = data.待发数量[i];
|
newRow.appendChild(pendingCell);
|
|
// 创建并设置已发数量单元格
|
var shippedCell = document.createElement("td");
|
shippedCell.innerText = data.已发数量[i];
|
newRow.appendChild(shippedCell);
|
|
// 创建并设置推荐仓位单元格
|
var locationCell = document.createElement("td");
|
locationCell.innerText = data.推荐仓位[i];
|
newRow.appendChild(locationCell);
|
|
// 创建并设置规格型号单元格
|
var specificationCell = document.createElement("td");
|
specificationCell.innerText = data.规格型号[i];
|
newRow.appendChild(specificationCell);
|
|
// 创建并设置图号单元格
|
var drawingCell = document.createElement("td");
|
drawingCell.innerText = data.图号[i];
|
newRow.appendChild(drawingCell);
|
|
// 将新的表格行添加到表格体中
|
tableBody.appendChild(newRow);
|
}
|
} else {
|
// 表格数据获取失败
|
alert("发生错误:" + response.message); // 使用弹窗显示错误信息
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
// 处理错误响应
|
console.log(errorThrown); // 输出错误信息
|
alert("发生错误:" + errorThrown); // 使用弹窗显示错误信息
|
}
|
});
|
});
|
|
function GetBarInfo() {
|
var barcodeInput = document.getElementById("DAB001");
|
var barcodeValue = barcodeInput.value;
|
|
|
|
if (event.keyCode == 13) {
|
|
// 如果未输入条码,跳出方法
|
if (barcodeValue === '') {
|
alert("请扫描条码!!!");
|
return;
|
}
|
|
var COMDFA = document.getElementById("order");
|
var selectedValue = COMDFA.value;
|
var splitValues = selectedValue.split("--");
|
|
if (splitValues.length === 2) {
|
var DFA001 = splitValues[0]; // 第一个值存入 DFA001
|
var DFB002 = splitValues[1]; // 第二个值存入 DFB002
|
}
|
|
console.log('1');
|
// var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
|
// var user_id = currentSession.user_id;
|
|
|
mui.ajax(app.API_URL_HEADER + "/WARBABChag/CreateXSCK", {
|
data: {
|
DAB001: barcodeValue,
|
user_id: "ADMIN",
|
DFA001: DFA001,
|
DFB002: DFB002,
|
},
|
dataType: "json",
|
type: "post",
|
async: false,
|
// timeout: 15000,
|
success: function(data) {
|
// console.log(JSON.stringify(data));
|
if (data.status != 0) {
|
playerAudio("NG");
|
alert(data.message);
|
console.log("1");
|
barcodeInput.value = ''; // 清空输入框的值
|
barcodeInput.blur(); // 先让输入框失去焦点
|
focusOnDAB001();
|
return;
|
} else {
|
mui.toast("出库成功!");
|
barcodeInput.value = ''; // 清空输入框的值
|
barcodeInput.blur(); // 先让输入框失去焦点
|
|
// 发起 AJAX 请求
|
mui.ajax({
|
url: app.API_URL_HEADER + "/WARBABChag/GetCOMDFB", // 后台接口的URL
|
type: 'POST', // 请求方法
|
data: {
|
DFA001: DFA001,
|
DFB002: DFB002, //获取复选框是否被选中(true,false)
|
}, // 请求参数,根据后台接口的要求进行修改
|
dataType: 'json', // 接收到的数据类型
|
success: function(response) {
|
// 处理成功响应
|
console.log(response); // 输出响应数据,你可以根据实际接口返回的数据进行相应的处理
|
|
if (response.status === 0) {
|
// 表格数据获取成功
|
var data = response.data;
|
var tableBody = document.querySelector("#myTable tbody");
|
tableBody.innerHTML = ""; // 清空表格内容
|
|
|
for (var i = 0; i < data.物料名称.length; i++) {
|
if(data.待发数量[i] == 0)
|
{
|
var tableBody = document.querySelector("#myTable tbody");
|
tableBody.innerHTML = ""; // 清空表格内容
|
fetchData();
|
return;
|
}
|
|
|
// 创建新的表格行
|
var newRow = document.createElement("tr");
|
|
// 创建并设置物料名称单元格
|
var nameCell = document.createElement("td");
|
nameCell.innerText = data.物料名称[i];
|
newRow.appendChild(nameCell);
|
|
// 创建并设置物料代码单元格
|
var codeCell = document.createElement("td");
|
codeCell.innerText = data.物料代码[i];
|
newRow.appendChild(codeCell);
|
|
// 创建并设置代发数量单元格
|
var pendingCell = document.createElement("td");
|
pendingCell.innerText = data.待发数量[i];
|
newRow.appendChild(pendingCell);
|
|
// 创建并设置已发数量单元格
|
var shippedCell = document.createElement("td");
|
shippedCell.innerText = data.已发数量[i];
|
newRow.appendChild(shippedCell);
|
|
// 创建并设置推荐仓位单元格
|
var locationCell = document.createElement("td");
|
locationCell.innerText = data.推荐仓位[i];
|
newRow.appendChild(locationCell);
|
|
// 创建并设置规格型号单元格
|
var specificationCell = document.createElement("td");
|
specificationCell.innerText = data.规格型号[i];
|
newRow.appendChild(specificationCell);
|
|
// 创建并设置图号单元格
|
var drawingCell = document.createElement("td");
|
drawingCell.innerText = data.图号[i];
|
newRow.appendChild(drawingCell);
|
|
// 将新的表格行添加到表格体中
|
tableBody.appendChild(newRow);
|
|
|
}
|
} else {
|
// 表格数据获取失败
|
alert("发生错误:" + response.message); // 使用弹窗显示错误信息
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
// 处理错误响应
|
console.log(errorThrown); // 输出错误信息
|
alert("发生错误:" + errorThrown); // 使用弹窗显示错误信息
|
}
|
});
|
|
}
|
},
|
error: function(xhr, type, errorThrown) {
|
console.log("失败");
|
mui.alert("获取数据异常:" + JSON.stringify(errorThrown));
|
}
|
});
|
}
|
}
|
|
|
function focusOnDAB001() {
|
var inputElement = document.getElementById("DAB001");
|
MUIinputElement.focus();
|
}
|
|
</script>
|
|
<style>
|
/* 添加表格样式 */
|
.data-table {
|
width: 100%;
|
border-collapse: collapse;
|
overflow-x: auto; /* 水平滚动条 */
|
}
|
|
|
.data-table th,
|
.data-table td {
|
border: 1px solid #ccc;
|
padding: 8px;
|
text-align: left;
|
word-wrap: break-word;
|
white-space: pre-wrap;
|
text-overflow: ellipsis; /* 文本截断和省略号 */
|
overflow: hidden;
|
}
|
|
/* 媒体查询 */
|
@media (max-width: 768px) {
|
.data-table {
|
/* 调整表格样式以适应小屏幕 */
|
}
|
}
|
|
option {
|
font-size: 40px; /* 调整下拉选项的字体大小 */
|
padding: 20px; /* 调整下拉选项的内边距 */
|
}
|
</style>
|