Files
RBMESAPICore/Views/Home/ERPAndMESComparison.cshtml
yuyubohh e8494ba988 qqq
2025-09-09 22:41:29 +08:00

156 lines
6.1 KiB
Plaintext
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.

@using RB_MES_APICore.Models.Request
@model IList<ERPMESMOXComparison>
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<script src="https://code.jquery.com/jquery.js"></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="text-center">
<h1 class="display-4">ERP与MES工单对照</h1>
</div>
<body>
<form asp-action="ERPAndMESComparison">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" />
<div class="form-inline">
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<div class="form-group">
<label class="control-label">年月yyyyMM:</label>
<input class="form-control" id="dbnumber" />
</div>
<a href="#" onclick="mynumber()">搜索</a>
<a href="#" onclick="Put()">批量推送</a>
<td style="width:50px;">
@* <a asp-action="SelectClumnConvertsAdd">添加</a> *@
</td>
</div>
</form>
<table class="table table-bordered" border="1" width="100%" cellpadding="4" cellspacing="1">
<thead>
<tr>
<th style="text-align: center;"><input type="checkbox" onclick="AllChecked()" id="allERPNo" /></th>
<th style="text-align: center;">序号</th>
<th style="text-align: center;">@Html.DisplayNameFor(model => model.FirstOrDefault().ERP_MO)</th>
<th style="text-align: center;">@Html.DisplayNameFor(model => model.FirstOrDefault().PROD_ID)</th>
<th style="text-align: center;">@Html.DisplayNameFor(model => model.FirstOrDefault().FDOCUMENTSTATUS)</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody id="tListBody">
@for (int i = 0; i < Model.Count; i++)
{
int row = @i + 1;
<tr>
<td style="text-align: center;">
<input type="checkbox" name="checkERPNo" data-ERPNo="@Model[i].ERP_MO" data-conveyDate="@Model[i].CONVEYDATE" />
</td>
<td style="text-align: center;">@row </td>
<td style="text-align: center;">
@Html.DisplayFor(model => model[i].ERP_MO)
</td>
<td style="text-align: center;">
@Html.DisplayFor(model => model[i].PROD_ID)
</td>
<td style="text-align: center;">
@Html.DisplayFor(model => model[i].FDOCUMENTSTATUS)
</td>
<td style="text-align: center;">
<a href="javascript:void(0)" onclick="ERPAndMESXomparisonMesPut('@Model[i].ERP_MO','@Model[i].CONVEYDATE')">推送</a>
</td>
</tr>
}
</tbody>
</table>
<script language="javascript">
function AllChecked() {
var checked = $('#allERPNo').prop('checked');
$('input[name="checkERPNo"]').prop("checked", checked)
}
function Put() {
var dataJson = [];
$('input[name="checkERPNo"]:checked').each(function (data) {
var erpNo = $(this).attr('data-ERPNo')
var conveyDate = $(this).attr('data-conveyDate')
if (erpNo == "") {
alert("工单编号不能为空!")
return;
}
dataJson.push({ erpNo: erpNo, conveyDate: conveyDate })
});
var putData = JSON.stringify(dataJson);
var url = '@Url.Action("ERPAndMESXomparisonMesPuts", "Home")' + `?putData=${putData}`
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
success: function (data) {
if(data != null){
if (data.Code == 0) {
var resMsg = "";
$.each(data.Data,(idx,item)=>{
resMsg += `${item["BillNo"]},${item["Message"]} \r\n`
})
alert(resMsg);
location.reload();
} else {
alert(data.Message);
}
}else{
alert("未知错误,请联系管理员排查");
}
},
error: function () {
}
});
}
function mynumber() {
var period = document.getElementById("dbnumber").value;
if (period == "") {
alert("【来源字段】为必填项");
}
var hf = location.pathname;
var v = hf.search("Home");
hf = hf.substring(0, v);
hf = hf + "Home/ERPAndMESComparison?period=" + period;
location.href = hf; //重新导航
return false;
};
function ERPAndMESXomparisonMesPut(erpMo, conveyDate) {
// alert("1")
if (erpMo == "") {
alert("工单编号不能为空!")
return;
}
var url = '@Url.Action("ERPAndMESXomparisonMesPut", "Home")' + `?mo=${erpMo}&conveyDate=${conveyDate}`
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
success: function (data) {
// $('#jsonData').html('Name: ' + data.Name + ', Age: ' + data.Age);
alert("code:" + data.code + ", resMsg:" + data.resMsg)
},
error: function () {
// $('#jsonData').html('Error retrieving data.');
}
});
}
</script>
</body>