纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

282 lines
10 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
#ISO {
width: 10px;
}
</style>
<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
<script src="~/Content/js/select2/select2.min.js"></script>
<script>
var ID = $.request("ID");
var Warehouse = $.request("Warehouse");
var WarehouseName = decodeURI($.request("WarehouseName"));
//var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
var LocationCode = $.request("LocationCode");
var LocationName = decodeURI($.request("LocationName"));
//var expArrivalDate = $
$(function () {
debugger;
InitControl();
if (ID != "") {
//$("#sel_Warehouse").children('option:selected').val(WarehouseName)
$("#sel_Warehouse").val([WarehouseName]).trigger("change");
$("#WarehouseName").val(WarehouseName);
var s = LocationName;
var str = LocationCode.split('-');
for (var i = 1; i <= str.length; i++) {
if (i == 1)
$("#Qu").val(str[1]);
if (i == 2)
$("#Pai").val(str[2]);
if (i == 3)
$("#Jia").val(str[3]);
if (i == 4)
$("#Ceng").val(str[4]);
if (i == 5)
$("#Ge").val(str[5]);
}
}
$("#sel_Warehouse").change(function () {
debugger;
var Was = $("#sel_Warehouse").children('option:selected').val();
$("#WarehouseName").val(Was);
//var VenCode = $("#sel_VenCode").children('option:selected').val();
});
});
$.getUrlParam = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
;
function InitControl() {
debugger;
var $VenCode = $("#sel_Warehouse");
$VenCode.select2({
allowClear: true,
escapeMarkup: function (m) {
return m;
}
});
$.ajax({
url: "/WMS/BasicSettings/GetWarehouse" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$.each(data, function (index, item) {
$VenCode.append("<option value='" + item.WarehouseName + "'>" + item.WarehouseCode + "</option>");
});
}
});
}
//新增条码
function btnCreate() {
var STNO = $("#STNO").text();
Vendor = $("#sel_VenCode").find("option:selected").val();
if (STNO == "") {
$.modalAlert("请先选择供应商!");
return;
}
var expArrivalDate = $("#ExpArivalDate").val();
if (expArrivalDate == '' || expArrivalDate == null) {
$.modalAlert("请先选择预计到货时间!");
return;
}
$.modalOpen2({
id: "Form",
title: "条码信息",
url: "/SRM/ASNSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
width: "800px",
height: "500px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
//新增箱号
function btnAddCartonNo() {
var STNO = $("#STNO").text();
Vendor = $("#sel_VenCode").find("option:selected").val();
if (STNO == "") {
$.modalAlert("请先选择供应商!");
return;
}
var expArrivalDate = $("#ExpArivalDate").val();
if (expArrivalDate == '' || expArrivalDate == null) {
$.modalAlert("请先选择预计到货时间!");
return;
}
$.modalOpen2({
id: "Form",
title: "箱号信息",
url: "/SRM/ASNCartonSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
width: "800px",
height: "500px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
//刷新
function reloadData() {
STNO = $("#STNO").text();
var queryJson = {
STNO: STNO,
}
$("#gridList").jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) },
}).trigger('reloadGrid');
}
//删除条码
function btn_delete() {
var objArr = "";
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
if (objList.length == 0) {
$.modalAlert("请选择要删除的数据!");
return;
}
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
objArr += "'" + rowData.ASNDETAILID + "',";
}
$.deleteForm({
url: "/SRM/ASNAdd/DeleteInfo" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
reloadData();
}
})
}
//新增库位
function submitForm() {
debugger;
var StackCode = "";
var StackName = "";
var Warehouse = "";
var WarehouseName = "";
var Qu = $("#Qu").val();
var Pai = $("#Pai").val();
var Jia = $("#Jia").val();
var Ceng = $("#Ceng").val();
var Ge = $("#Ge").val();
if (Qu == "" && Pai == "" && Jia == "" && Ceng == "" && Ge == "") {
$.modalAlert("请输入库位编码!");
return;
}
StackCode = $("#sel_Warehouse").find("option:selected").text();
StackName = $("#sel_Warehouse").find("option:selected").text() + "仓库";
if (Qu!="") {
StackCode += "-" + Qu;
StackName += Qu + "区";
}
if (Pai!="") {
StackCode += "-" + Pai;
StackName += Pai + "排";
}
if (Jia!="") {
StackCode += "-" + Jia;
StackName += Jia + "货架";
}
if (Ceng!="") {
StackCode += "-" + Ceng;
StackName += Ceng + "层";
}
if (Ge!="") {
StackCode += "-" + Ge;
StackName += Ge + "格";
}
var objArr = {
ID:ID,
StackCode:StackCode,
StackName:StackName,
Warehouse:$("#sel_Warehouse").find("option:selected").text(),
WarehouseName:$("#WarehouseName").val()
}
if (ID != "") {
$.submitForm({
url: "/WMS/BasicSettings/UpdateStack" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
} else {
$.submitForm({
url: "/WMS/BasicSettings/InsertStack" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
}
</script>
<form id="form1">
<div style="padding-top: 20px; margin-right: 20px;">
<table class="form">
<tr>
<th class="formTitle">库房编号:</th>
<td style="width:100px">
<select id="sel_Warehouse" name="sel_Warehouse" class="form-control select2" style="width: 500px" placeholder="库房编号"></select>
<input type="hidden" id="hidetext" />
</td>
</tr>
<tr>
<th class="formTitle">库房名称:</th>
<td class="formValue">
<input id="WarehouseName" name="WarehouseName" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="库房名称" />
</td>
</tr>
<tr>
<th class="formTitle">库位编号:</th>
<td class="formValue">
<input id="Qu" name="Qu" type="text" class="form-control required" style="width:80px;" maxlength="10" placeholder="区" />
</td>
@*<td id="ISO">-</td>*@
<td class="formValue">
<input id="Pai" name="Pai" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="排" />
</td>
@*<td style="width:30px">-</td>*@
<td class="formValue">
<input id="Jia" name="Jia" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" />
</td>
@*<td style="width:30px">-</td>*@
<td class="formValue">
<input id="Ceng" name="Ceng" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" />
</td>
@*<td style="width:30px">-</td>*@
<td class="formValue">
<input id="Ge" name="Ge" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="格" />
</td>
</tr>
<tr>
<th class="formTitle">格式:</th>
<td class="formValue">
<span>&nbsp;区</span>
</td>
<td class="formValue">
<span>&nbsp;排</span>
</td>
<td class="formValue">
<span>&nbsp;货架</span>
</td>
<td class="formValue">
<span>&nbsp;层</span>
</td>
<td class="formValue">
<span>&nbsp;格</span>
</td>
</tr>
</table>
</div>
</form>