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.
537 lines
22 KiB
537 lines
22 KiB
|
|
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Form.cshtml";
|
|
}
|
|
<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
|
|
<link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
|
|
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
|
|
<script src="~/Content/js/bootstrap/bootstrap-select.js"></script>
|
|
<script src="~/Content/js/select2/select2.min.js"></script>
|
|
<script src="~/Content/js/layer/layer.js"></script>
|
|
<style>
|
|
#Additem {
|
|
margin-left: 45%;
|
|
}
|
|
|
|
#AddTemitem {
|
|
margin-right: 45%;
|
|
}
|
|
|
|
.ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td {
|
|
overflow: inherit;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.ui-jqgrid tr.jqgrow td {
|
|
white-space: normal !important;
|
|
height: auto;
|
|
}
|
|
</style>
|
|
<script>
|
|
|
|
var _Clos = new Array();
|
|
var rfqcode = $.request("rfqcode");
|
|
var ID = $.request("ID");
|
|
var InCode = $.request("InCode");
|
|
$(function(){
|
|
SetCols();
|
|
var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
|
|
var now = new Date();
|
|
var date = now.toLocaleDateString();
|
|
InitControl();
|
|
InitContro2();
|
|
InitContro3();
|
|
if (!!InCode) {
|
|
$.ajax({
|
|
url: "/DHAY/ICSCustomerSuppliedIn/GetICSOtherInByInCode?InCode=" + InCode,
|
|
//data: { keyValue: keyValue },
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
debugger;
|
|
$("#sel_CodeType").val([data.rows[0].EATTRIBUTE2]).trigger("change");//单据类型
|
|
$("#Code").val(data.rows[0].InCode);//单号
|
|
$("#sel_Dept").val([data.rows[0].EATTRIBUTE1]).trigger("change");//受益部门
|
|
$("#txtSYproject").val([data.rows[0].EATTRIBUTE7]).trigger("change");//受益项目
|
|
$("#txtApplyNegCode").val(data.rows[0].EATTRIBUTE3);//在建工程项目
|
|
$("#sel_Custmer").val([data.rows[0].EATTRIBUTE4]).trigger("change");//客户
|
|
$("#Remarks").val(data.rows[0].EATTRIBUTE5);//备注
|
|
$("#txtMUSER").val(Muser);
|
|
$("#txtMTIME").val(date);
|
|
}
|
|
})
|
|
}
|
|
reloadData();
|
|
})
|
|
function SetCols() {
|
|
$.ajax({
|
|
url: "/Print/SelectColumnName?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
var cols = new Array();
|
|
|
|
var collast = { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true };
|
|
cols.push(collast);
|
|
var collast = { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '规格型号', name: 'InvStd', width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '仓库编码', name: 'WHCode', width: 100, align: 'left', hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: '仓库名称', name: 'WHCodeName', width: 100, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
var collast = { label: '批号', name: 'Batch', width: 100, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } };
|
|
cols.push(collast);
|
|
var collast = { label: '备注', name: 'EATTRIBUTE6', width: 150, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
|
|
if (data != null && data.length > 0) {
|
|
DateList = data;
|
|
for (var i = 0; i < data.length; i++) {
|
|
var ColName = data[i].ColName;
|
|
var ColCode = data[i].ColCode;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColName,
|
|
name: ColCode,
|
|
width: 80,
|
|
align: "left"
|
|
}
|
|
cols.push(obj);
|
|
}
|
|
}
|
|
_Clos = cols;
|
|
}
|
|
});
|
|
}
|
|
|
|
function reloadData() {
|
|
$("#gridList").dataGrid({
|
|
url: "/DHAY/ICSCustomerSuppliedIn/GetICSReturnTemporary?rfqno=" + $("#Code").val() + "&" + Math.random(),
|
|
height: $(window).height() - 200,
|
|
width: $(window).width() - 300,
|
|
cellEdit: true,
|
|
colModel: _Clos,
|
|
cellsubmit: "clientArray",
|
|
shrinkToFit: false,//宽度自适应
|
|
autoWidth: true,
|
|
gridComplete: function () {
|
|
debugger;
|
|
//设置select
|
|
//var RowDatas = $("#gridList").jqGrid('getDataIDs');
|
|
//for (var j = 0; j < RowDatas.length; j++) {
|
|
// var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID");
|
|
// var WHCode = $("#gridList").jqGrid("getCell", RowDatas[j], "WHCodeHHH");
|
|
// GetSelectPerson(ID, WHCode);
|
|
//}
|
|
|
|
},
|
|
|
|
pager: "#gridPager",
|
|
sortorder: "desc",
|
|
sortname: 'DNCode ',
|
|
viewrecords: true,
|
|
multiselect: true,
|
|
subGrid: false, // (1)开启子表格支持
|
|
ondblClickRow: function (rowid, cellname, value) {
|
|
var colModel = $("#gridList").jqGrid("getGridParam", "colModel");
|
|
var cellIndex = $("#gridList").jqGrid("getGridParam", "iCol");
|
|
var cellname = colModel[cellIndex].name;
|
|
if (cellname == "InvCode") {
|
|
$.modalOpen({
|
|
id: "InvCodeSelect",
|
|
title: "选择物料信息",
|
|
url: "/DHAY/ICSCustomerSuppliedReturn/GetInvCode",
|
|
width: "50%",
|
|
height: "50%",
|
|
callBack: function (iframeId) {
|
|
debugger;
|
|
var obj = top.frames[iframeId].submitForm();
|
|
$("#gridList").jqGrid('setCell', rowid, 'InvCode', obj.INVCODE, 'review-' + rowid);
|
|
$("#gridList").jqGrid('setCell', rowid, 'INVNAME', obj.INVNAME, 'review-' + rowid);
|
|
$("#gridList").jqGrid('setCell', rowid, 'InvStd', obj.InvStd, 'review-' + rowid);
|
|
$("#gridList").jqGrid("saveCell", rowid, 1);
|
|
$("#gridList").jqGrid("saveCell", rowid, 2);
|
|
$("#gridList").jqGrid("saveCell", rowid, 3);
|
|
$("#gridList").jqGrid("saveCell", rowid, 4);
|
|
$("#gridList").jqGrid("saveCell", rowid, 5);
|
|
$("#gridList").jqGrid("saveCell", rowid, 6);
|
|
$("#gridList").jqGrid("saveCell", rowid, 7);
|
|
$("#gridList").jqGrid("saveCell", rowid, 8);
|
|
$("#gridList").jqGrid("saveCell", rowid, 9);
|
|
top.frames[iframeId].Close();
|
|
}
|
|
|
|
});
|
|
} else if (cellname == "WHCodeName") {
|
|
$.modalOpen({
|
|
id: "GetWHCode",
|
|
title: "选择仓库",
|
|
url: "/DHAY/ICSCustomerSuppliedOut/GetWHCode",
|
|
width: "50%",
|
|
height: "50%",
|
|
callBack: function (iframeId) {
|
|
debugger;
|
|
var obj = top.frames[iframeId].submitForm();
|
|
$("#gridList").jqGrid('setCell', rowid, 'WHCode', obj.WarehouseCode, 'review-' + rowid);
|
|
$("#gridList").jqGrid('setCell', rowid, 'WHCodeName', obj.WarehouseName, 'review-' + rowid);
|
|
$("#gridList").jqGrid("saveCell", rowid, 1);
|
|
$("#gridList").jqGrid("saveCell", rowid, 2);
|
|
$("#gridList").jqGrid("saveCell", rowid, 3);
|
|
$("#gridList").jqGrid("saveCell", rowid, 4);
|
|
$("#gridList").jqGrid("saveCell", rowid, 5);
|
|
$("#gridList").jqGrid("saveCell", rowid, 6);
|
|
$("#gridList").jqGrid("saveCell", rowid, 7);
|
|
$("#gridList").jqGrid("saveCell", rowid, 8);
|
|
$("#gridList").jqGrid("saveCell", rowid, 9);
|
|
top.frames[iframeId].Close();
|
|
}
|
|
|
|
});
|
|
} else if (cellname == "Batch") {
|
|
$.modalOpen({
|
|
id: "InvCodeSelect",
|
|
title: "选择批次信息",
|
|
url: "/DHAY/ICSCustomerSuppliedReturn/GetBatch",
|
|
width: "50%",
|
|
height: "50%",
|
|
callBack: function (iframeId) {
|
|
debugger;
|
|
var obj = top.frames[iframeId].submitForm();
|
|
$("#gridList").jqGrid('setCell', rowid, 'Batch', obj.BatchCode, 'review-' + rowid);
|
|
$("#gridList").jqGrid("saveCell", rowid, 1);
|
|
$("#gridList").jqGrid("saveCell", rowid, 2);
|
|
$("#gridList").jqGrid("saveCell", rowid, 3);
|
|
$("#gridList").jqGrid("saveCell", rowid, 4);
|
|
$("#gridList").jqGrid("saveCell", rowid, 5);
|
|
$("#gridList").jqGrid("saveCell", rowid, 6);
|
|
$("#gridList").jqGrid("saveCell", rowid, 7);
|
|
$("#gridList").jqGrid("saveCell", rowid, 8);
|
|
$("#gridList").jqGrid("saveCell", rowid, 9);
|
|
top.frames[iframeId].Close();
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
},
|
|
/* footerrow: true,//启用底部行(对列汇总时要启用)第一步*/
|
|
|
|
});
|
|
}
|
|
|
|
|
|
function btnLook(cellvalue, options, rowObject) {
|
|
return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">查看</a>";
|
|
}
|
|
|
|
function UpLoadClick(ID) {
|
|
$.modalOpen({
|
|
id: "selectDeatil",
|
|
title: "查看修改物料",
|
|
url: "/WMS/ProductionIssue/SeachInventory?ID=" + ID + "&" + Math.random(),
|
|
width: "1000px",
|
|
height: "1000px",
|
|
callBack: function (iframeId) {
|
|
var obj = top.frames[iframeId].submitForm();
|
|
var rowData = $("#gridList").jqGrid('getRowData', ID);
|
|
rowData.TLZID=obj.TLZID,
|
|
rowData.ZJID= obj.ZJID,
|
|
rowData.InvCode= obj.InvCode,
|
|
rowData.InvName= obj.InvName,
|
|
rowData.InvStd= obj.InvStd,
|
|
rowData.InvUnit= obj.InvUnit,
|
|
rowData.Quantity= obj.Quantity,
|
|
rowData.IssueNegQuantity= obj.IssueQuantity,
|
|
rowData.Amount= obj.Amount,
|
|
rowData.ExtensionID= obj.ExtensionID,
|
|
rowData.ProjectCode= obj.ProjectCode,
|
|
rowData.BatchCode= obj.BatchCode,
|
|
rowData.Version= obj.Version,
|
|
rowData.Brand= obj.Brand,
|
|
rowData.cFree1= obj.cFree1,
|
|
rowData.cFree2= obj.cFree2,
|
|
rowData.cFree3= obj.cFree3,
|
|
rowData.cFree4= obj.cFree4,
|
|
rowData.cFree5= obj.cFree5,
|
|
rowData.cFree6= obj.cFree6,
|
|
rowData.cFree7= obj.cFree7,
|
|
rowData.cFree8= obj.cFree8,
|
|
rowData.cFree9= obj.cFree9,
|
|
rowData.cFree10= obj.cFree10
|
|
$("#gridList").jqGrid('setRowData', ID, rowData);
|
|
$(".unwritten").hide();
|
|
top.frames[iframeId].Close();
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
function guid() {
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
return v.toString(16);
|
|
});
|
|
}
|
|
//最后一行新增数据
|
|
function AddRowToLast() {
|
|
var obj = {
|
|
ID: guid(),
|
|
WHCode:""
|
|
|
|
};
|
|
|
|
$("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
|
|
$(".unwritten").hide();
|
|
}
|
|
|
|
function DeleteRowToLast() {
|
|
debugger;
|
|
var rowid = $("#gridList").jqGridRowValue().ID
|
|
$("#gridList").delRowData(rowid);
|
|
|
|
}
|
|
|
|
//获取U9单据类型
|
|
function InitControl() {
|
|
var $CodeType = $("#sel_CodeType");
|
|
$CodeType.select2({
|
|
allowClear: true,
|
|
escapeMarkup: function (m) {
|
|
return m;
|
|
}
|
|
});
|
|
$.ajax({
|
|
url: "/DHAY/ICSCustomerSuppliedReturn/GetU9CodeType" + "?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
$.each(data, function (index, item) {
|
|
$CodeType.append("<option value='" + item.Code + "'> " + item.Name + "</option>");
|
|
});
|
|
}
|
|
});
|
|
}
|
|
//获取U9部门
|
|
function InitContro2() {
|
|
var $Dept = $("#sel_Dept");
|
|
$Dept.select2({
|
|
allowClear: true,
|
|
escapeMarkup: function (m) {
|
|
return m;
|
|
}
|
|
});
|
|
$.ajax({
|
|
url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Department" + "?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
$.each(data, function (index, item) {
|
|
$Dept.append("<option value='" + item.Code + "'> " + item.Name + "</option>");
|
|
});
|
|
}
|
|
});
|
|
}
|
|
//获取U9客户
|
|
function InitContro3() {
|
|
var $Custmer = $("#sel_Custmer");
|
|
$Custmer.select2({
|
|
allowClear: true,
|
|
escapeMarkup: function (m) {
|
|
return m;
|
|
}
|
|
});
|
|
$.ajax({
|
|
url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Customer" + "?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
$.each(data, function (index, item) {
|
|
$Custmer.append("<option value='" + item.Code + "'> " + item.Name + "</option>");
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function submitForm() {
|
|
$("#gridList").find($("td[aria-describedby='gridList_rn']")).click();
|
|
debugger;
|
|
if (!$('#form1').formValid()) {
|
|
return false;
|
|
}
|
|
var CodeType = $("#sel_CodeType").val();//单据类型
|
|
var Dept = $("#sel_Dept").val();//部门
|
|
var ApplyNegCode = $("#txtApplyNegCode").val();//在建项目
|
|
var Custmer = $("#sel_Custmer").val();//客户
|
|
var Remarks = $("#Remarks").val();//备注
|
|
var Code = $("#Code").val();//单据号
|
|
var MTIME = $("#txtMTIME").val();//单据号
|
|
var SYproject = $("#txtSYproject").val();//受益项目
|
|
var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
|
|
var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
|
|
var IDlist = "";
|
|
var Details = [];
|
|
SelPerson = "#SelBR_"
|
|
var obj_vendor = $("#gridList");
|
|
var rowIds_vendor = obj_vendor.getDataIDs();
|
|
var arrayData_vendor = new Array();
|
|
if (rowIds_vendor.length > 0) {
|
|
for (var i = 0; i < rowIds_vendor.length; i++) {
|
|
var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
|
|
if (vendorRowData.Quantity == "" || vendorRowData.Quantity == 'undefined') {
|
|
$.modalAlertNew("WMS00089");
|
|
return;
|
|
}
|
|
/* var WHCode = $("" + SelPerson + "" + vendorRowData.ID + "").val();*/
|
|
var obj = {
|
|
ID: vendorRowData.ID,
|
|
Sequence: i + 1,
|
|
InvCode: vendorRowData.InvCode,
|
|
Quantity: vendorRowData.Quantity,
|
|
WHCode: vendorRowData.WHCode,
|
|
DetailReamrk: vendorRowData.EATTRIBUTE6,
|
|
Batch: vendorRowData.Batch
|
|
};
|
|
Details.push(obj);
|
|
}
|
|
var ICSASNs = {
|
|
Dept: Dept,
|
|
CodeType: CodeType,
|
|
ApplyNegCode: ApplyNegCode,
|
|
Custmer: Custmer,
|
|
Remarks: Remarks,
|
|
Code: Code,
|
|
MTIME: MTIME,
|
|
SYproject: SYproject,
|
|
User: RoleEnCode,
|
|
Detail: Details,
|
|
}
|
|
var ICSASN = [];
|
|
ICSASN.push(ICSASNs);
|
|
$.submitForm({
|
|
|
|
url: "/DHAY/ICSCustomerSuppliedIn/UpdateICSOtherIn?" + Math.random(),
|
|
param: { ICSASN: JSON.stringify(ICSASN) },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function GetSelectPerson( ID, WHCode) {
|
|
var str = "";
|
|
$.ajax({
|
|
url: "/DHAY/ICSCustomerSuppliedIn/Select_ICSWHCode?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
async: false,
|
|
success: function (data) {
|
|
if (data != null && data.length > 0) {
|
|
$("#SelBR_" + ID + "").find("option").remove();
|
|
for (var i = 0; i < data.length; i++) {
|
|
$("#SelBR_" + ID + "").append("<option value='" + data[i].WarehouseCode + "'>" + data[i].WarehouseName + "</option>");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#SelBR_" + ID + "").selectpicker('refresh');
|
|
$("#SelBR_" + ID + "").selectpicker('val', WHCode);
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
<form id="form1">
|
|
<div class="topPanel" style="height:10px">
|
|
<div class="btn-group">
|
|
@*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
|
|
<a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
|
|
</div>
|
|
</div>
|
|
<div style="margin-right: 20px;">
|
|
<table class="form">
|
|
<thead>主表信息</thead>
|
|
<tr>
|
|
<th class="formTitle">单据类型:</th>
|
|
<td class="formValue">
|
|
<select id="sel_CodeType" name="sel_CodeType" class="form-control select2 required" style="width: 230px" placeholder="请选择单据类型..."></select>
|
|
<input type="hidden" id="hidetext" />
|
|
</td>
|
|
<th class="formTitle">单号:</th>
|
|
<td class="formValue">
|
|
<input id="Code" type="text" readonly="readonly" class="form-control required" />
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<th class="formTitle">受益部门:</th>
|
|
<td class="formValue">
|
|
<select id="sel_Dept" name="sel_Dept" class="form-control select2 required" style="width: 230px" placeholder="请选择受益部门..."></select>
|
|
<input type="hidden" id="hidetext" />
|
|
</td>
|
|
<th class="formTitle">受益项目:</th>
|
|
<td class="formValue">
|
|
<input type="text" id="txtSYproject" class="form-control" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="formTitle">在建工程项目:</th>
|
|
<td class="formValue">
|
|
<input type="text" id="txtApplyNegCode" class="form-control" />
|
|
</td>
|
|
<th class="formTitle">客户:</th>
|
|
<td class="formValue">
|
|
<select id="sel_Custmer" name="sel_Custmer" class="form-control select2" style="width: 230px" placeholder="请选择客户..."></select>
|
|
<input type="hidden" id="hidetext" />
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
|
|
<th class="formTitle">备注:</th>
|
|
<td class="formValue">
|
|
<input type="text" id="Remarks" class="form-control" />
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<th class="formTitle">维护人:</th>
|
|
<td class="formValue">
|
|
<input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
|
|
</td>
|
|
<th class="formTitle">维护时间:</th>
|
|
<td class="formValue">
|
|
<input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
<div class="gridPanel" style="margin-left:10px">
|
|
<span><strong>子表信息</strong></span>
|
|
<table id="gridList"></table>
|
|
<div style="text-align:center">
|
|
<button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
|
|
<button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|