天津投入产出系统后端
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.
 
 
 
 
 
 

298 lines
11 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.MD.Web.Models.MaterialClassModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
物料类型树管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.QPSeach(100,true) %>
<table id="condiTable">
<tr>
<th align="right">
<%=Html.QV(p => p.MATERIAL_NAME)%>
</th>
<td>
<%=Html.QC(p => p.MATERIAL_NAME)%>
</td>
<th align="right">
<%=Html.QV(p => p.MATERIAL_CODE)%>
</th>
<td>
<%=Html.QC(p => p.MATERIAL_CODE)%>
</td>
<th align="right">
<%=Html.QV(p => p.COLOR)%>
</th>
<td>
<%=Html.QC(p => p.COLOR)%>
</td>
<th align="right">
<%=Html.QV(p => p.HBTYPE)%>
</th>
<td>
<%=Html.QC(p => p.HBTYPE)%>
</td>
</tr>
<tr>
<th align="right">
<%=Html.QV(p=>p.FACTORY_CODE) %>
</th>
<td>
<%=Html.QC(p => p.FACTORY_CODE)%>
</td>
<th align="right">
<%=Html.QV(p => p.PROJECTCODE)%>
</th>
<td>
<%=Html.QC(p => p.PROJECTCODE)%>
</td>
</tr>
</table>
<div style="left: 1px; position: relative;"></div>
<%=Html.QPEnd()%>
<%=Html.QPEdit() %>
<div class="panel datagrid">
<table id="tg"></table>
</div>
<%=Html.QPEnd() %>
<%=Html.Hidden("selectKey")%>
<%=Html.HiddenFor(p => p.PID)%>
<%=Html.HiddenFor(p => p.PROJECT_NAME)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<table id="_tableButton" cellpadding="0" cellspacing="0">
<tr>
<td>
<%-- <%=Html.QTButtonSearch("MaterialClass", "List", "List()", QMAPP.Common.Web.SystemLimit.isLimt)%>
--%>
<%=Html.QTButton("selectMaterialAll", "List", QMFrameWork.WebUI.IconCls.search, "List();", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("selectMaterialCode", "ListCode", QMFrameWork.WebUI.IconCls.search, "ListCode()", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("setMaterialClass", "AddMaterialClass", QMFrameWork.WebUI.IconCls.add, "AddMaterialClass();", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("setMaterialCode", "AddMaterialCode", QMFrameWork.WebUI.IconCls.add, "AddMaterialCode()", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButtonDelete("MaterialClass", "Delete", "Delete()", QMAPP.Common.Web.SystemLimit.isLimt)%>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript">
var parentCode = "";
var myCode = "";
var pid = "";
var isChildren = false;
var isAll = 0;
$(function () {
//工厂
$('#FACTORY_CODE').combobox({
onSelect: function () {
var selectCode = $('#FACTORY_CODE').combobox('getValue');
if (selectCode != "") {
//获取下拉数据源
$('#PROJECTCODE').combobox({
url: "/Dict/GetFactoryProjectComboxSource?factoryCode=" + selectCode,
editable: 'false',
valueField: 'PROJECT_CODE',
textField: 'PROJECT_NAME'
});
$('#PROJECTCODE').combobox("setValue", "");
}
else {
//清空工序下拉框
var emptyData = [{ 'PROJECT_CODE': "", 'PROJECT_NAME': ""}];
$('#PROJECTCODE').combobox("loadData", emptyData);
$('#PROJECTCODE').combobox("select", "");
}
}
});
ListTreegrid();
});
/*响应节点点击事件*/
function onClickRow(row) {
pid = row.PID;
myCode = row.Id;
var parent = $('#tg').treegrid('getParent', row.PID);
if (parent == null) {
//alert("根节点");
//return;
parentCode = "";
} else {
parentCode = parent.Id;
}
var children = $('#tg').treegrid('getChildren', row.PID);
if (children[0] == null) {
// alert("子节点");
// return;
isChildren = true;
} else {
isChildren = false;
}
}
//查询
function List() {
//debugger ;
isAll = 0;
ListTreegrid();
}
function ListCode() {
//debugger;
isAll = 1;
ListTreegrid();
}
//刷新treegrid
function ListTreegrid() {
var MATERIAL_CODE = $("#MATERIAL_CODE").val();
//汉字乱码
var MATERIAL_NAME = escape($("#MATERIAL_NAME").val());
var COLOR = $('#COLOR').combobox('getValue');
var HBTYPE = $('#HBTYPE').combobox('getValue');
$('#tg').treegrid({
// title: 'TreeGrid with Footer',
// iconCls: 'icon-ok',
width: 1140,
height: 466,
rownumbers: false,
animate: false,
collapsible: true,
fitColumns: true,
url: '/MaterialClass/GetMaterialTree?MATERIAL_CODE=' + MATERIAL_CODE + '&MATERIAL_NAME=' + MATERIAL_NAME + '&COLOR=' + COLOR + '&HBTYPE=' + HBTYPE + '&isAll=' + isAll,
method: 'get',
idField: 'PID',
treeField: 'Text',
showFooter: false,
onClickRow: onClickRow,
columns: [[
{ title: 'PID', field: 'PID', width: 0, hidden: true },
{ title: '物料', field: 'Text', width: 240 },
{ title: '编码', field: 'Id', width: 100 },
{ title: '简称', field: 'MATERIAL_SHORT', width: 80 },
{ title: '项目号', field: 'PROJECTCODE', width: 90 },
{ title: '颜色', field: 'COLOR', width: 50 },
{ title: '配置', field: 'HBTYPE', width: 50 },
{ title: '包装数量', field: 'STD_QTY', width: 50 },
{ title: '外购件', field: 'OUTSOURCE', width: 50 },
{ title: '描述', field: 'REMARK', width: 50 }
]]
});
}
//添加物料号
function AddMaterialCode() {
if (pid=="") {
MSI("提示", "请选择物料类型!");
return;
}
if (myCode == "") {
MSI("提示", "请选择物料类型!");
return;
}
// if (isChildren) {
// openAppWindow1('添加物料号', 'AddMaterialCode?materialTypeCode=' + parentCode, '520', '480');
// } else {
// openAppWindow1('添加物料号', 'AddMaterialCode?materialTypeCode=' + myCode, '520', '480');
// }
openAppWindow1('添加物料号', 'AddMaterialCode?materialTypeCode=' + myCode, '560', '320');
}
//添加物料类型
function AddMaterialClass() {
// if (isChildren) {
// MSI("提示", "请选择物料类型!");
// return;
// }
if (pid == "") {
MSI("提示", "请选择物料类型!");
return;
}
if (myCode == "") {
MSI("提示", "请选择物料类型!");
return;
}
openAppWindow1('添加物料类型', 'AddMaterialClass?materialTypeCode=' + myCode, '400', '350');
}
//删除PBOM
function Delete() {
if (!isChildren) {
MSI("提示", "只能删除子节点!");
return;
}
if (pid == "") {
MSI("提示", "请选择物料类型!");
return;
}
if (myCode == "") {
MSI("提示", "请选择物料类型!");
return;
}
MSQ("提示", "确定要删除吗?", function () {
$.ajax({
type: "POST",
url: "/MaterialClass/Delete?PID=" + pid,
cache: false,
async: false,
dataType: "json",
data: {},
success: function (data) {
MSI("提示", "删除成功");
// if (data == "删除成功") {
// $('#PbomItemTree').tree('remove', node.target);
// }
},
error: function () {
MSI("提示", "删除失败");
}
});
//$('#PbomItemTree').tree('remove', node.target);
$('#tg').treegrid('remove', pid);
});
}
//添加节点
function AddNode(id, code, text) {
var node = $('#PbomItemTree').tree('getSelected');
$('#PbomItemTree').tree('append', {
parent: (node ? node.target : null),
data: [{
id: id,
code: code,
text: text,
checked: true
}]
});
}
//更新节点
function UpdateNode(id, text) {
var node = $('#PbomItemTree').tree('getSelected');
if (node) {
node.text = text;
$('#PbomItemTree').tree('update', node);
}
}
//返回
function Return() {
var returnUrl = "/Pbom/List";
window.location.href = returnUrl;
}
$(function () {
$('#FACTORY_CODE').combobox({
panelWidth: '350'
});
});
</script>
</asp:Content>