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

349 lines
14 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.FJC.Web.Models.Stocktaking.StocktakingSearchModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
工厂信息编辑
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.QPEdit("信息", string.IsNullOrEmpty(Model.PID) ? QMFrameWork.WebUI.panelType.Add : QMFrameWork.WebUI.panelType.Update)%>
<table id="editTable" cellpadding="0" cellspacing="0">
<tr>
<td>
<table>
<tr>
<th align="right">
<%=Html.QV(p => p.PLAN_DATE)%>
</th>
<td>
<input id="PLAN_DATE" name="PLAN_DATE" value="<%=string.IsNullOrEmpty(Model.PID)?DateTime.Now.ToString("yyyy-MM-dd"):Model.PLAN_DATE.ToString() %>"
type="text" class="easyui-datebox" required="required" style="width:185px" />
</td>
</tr>
<tr>
<th align="right">
<%=Html.QV(p => p.COUNTTYPE)%>
</th>
<td>
<%=Html.QC(p => p.COUNTTYPE)%>
</td>
</tr>
<tr>
<th align="right">
<%=Html.QV(p => p.REMARK)%>
</th>
<td>
<%=Html.QC(p => p.REMARK)%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="QDateGrid">
</table>
<%=Html.HiddenFor(p=>p.PID) %>
<%=Html.HiddenFor(p=>p.CREATEDATE) %>
<%=Html.HiddenFor(p=>p.CREATEUSER) %>
<%=Html.HiddenFor(p=>p.UPDATEDATE)%>
<%=Html.HiddenFor(p=>p.UPDATEUSER) %>
<%=Html.HiddenFor(p => p.MaterialCodes)%>
<%=Html.QPEnd() %>
<div id="addMaterialWindow" class="easyui-window" title="新增物料信息" iconcls="icon-save"
closed="true" style="width: 400px; height: 300px; padding: 5px;">
<div class="easyui-layout" fit="true">
<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
<table id="Table3">
<tr>
<th align="right">
<%=Html.QV(p => p.MATERIAL_TYPE_CODE)%>
</th>
<td>
<%=Html.QC(p => p.MATERIAL_TYPE_CODE)%>
</td>
</tr>
<tr>
<th align="right">
<%=Html.QV(p => p.MATERIAL_CODE)%>
</th>
<td>
<%=Html.QC(p => p.MATERIAL_CODE)%>
</td>
</tr>
</table>
</div>
<div region="north" border="false" style="text-align: left;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<%=Html.QTButtonSave("StocktakingManage", "TransitSave", "AddMaterialSave()")%>
<%=Html.QTButtonBack("Home", "Index", "AddMaterialCancel()")%>
</td>
</tr>
</table>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
$(function () {
$('#QDateGrid').datagrid({
width: 350,
height: 300,
fit: true,
nowrap: false,
striped: true,
collapsible: false,
pagination: true,
rownumbers: false,
remoteSort: false,
idField: 'MATERIAL_CODE',
columns: [[
{ field: 'MATERIAL_CODE', title: '物料号', align: 'center', width: 150 },
{ field: 'MATERIAL_TYPE_CODE', title: '物料类别', align: 'center', width: 180 },
{ field: 'CREATEUSERNMAE', title: '操作人', align: 'center', width: 150 },
{ field: 'CREATEDATE', title: '操作时间', align: 'center', width: 150 }
]],
//*************增加****************************
toolbar: [{
text: '添加',
iconCls: 'icon-add',
handler: function () {
$('#MATERIAL_CODE').combobox("setValue", "");
var datest = $("#PLAN_DATE").datebox("getValue");
if (datest == "") {
MSI("提示", "请填写盘点日期!");
return false;
};
OpenAddMaterial();
}
},
//************删除*****************************
{
text: '删除',
iconCls: 'icon-remove',
handler: function () {
var selectedRowIds = $('#QDateGrid').datagrid('getSelections');
var len = selectedRowIds.length;
if (len == 0) {
MSI("提示", "请选择要删除的物料信息!");
return false;
}
for (var i = 0; i < len; i++) {
var rowIndex = $('#QDateGrid').datagrid('getRowIndex', selectedRowIds[0]);
$("#QDateGrid").datagrid("deleteRow", rowIndex);
}
//********************************************
}
}
]
//**********************************************
});
});
//***************************************新增物料信息************************
function OpenAddMaterial() {
$('#addMaterialWindow').window({
title: '新增物料信息',
modal: true,
shadow: false,
closed: true,
left: 10,
top: 10,
width: 350,
closable: true,
minimizable: false,
maximizable: false,
height: 280,
collapsible: false
});
$('#addMaterialWindow').window('open');
//初始化物料信息下拉
$('#MATERIAL_TYPE_CODE').combotree
({
url: '/Dict/GetMaterialClassTree?attr=1',
panelHeight: '150',
panelWidth: '500',
onBeforeSelect: function (node) {
if (!$(this).tree('isLeaf', node.target)) {
return false;
}
},
onSelect: function (node) {
var materialtype = node.id;
// var materialtype = $('#MATERIAL_TYPE_CODE').combobox('getValue');
if (materialtype != "") {
//获取物料下拉数据源
$('#MATERIAL_CODE').combobox
({
url: "/Dict/GetMaterialWithTypeComboxSource?materialtype=" + materialtype,
panelHeight: '200',
panelWidth: '350',
editable: 'false',
valueField: 'MATERIAL_CODE',
textField: 'MATERIAL_NAME',
multiple: true,
formatter: function (row) {
var opts = $(this).combobox('options');
//关键在这一步,在项前面加一个checkbox。opts这个是combobox对象。
return row[opts.textField];
}
});
$('#MATERIAL_CODE').combobox("setValue", "");
}
else {
//清空物料下拉框
var plantData = [{ 'MATERIAL_CODE': "", 'MATERIAL_NAME': ""}];
$('#MATERIAL_CODE').combobox("loadData", plantData);
$('#MATERIAL_CODE').combobox("select", "");
}
}
});
}
//***************************************************************************
function AddMaterialSave() {
//获取物料类别
var materialtype = $('#MATERIAL_TYPE_CODE').combobox('getValue');
//获取物料号
var machinecode = $('#MATERIAL_CODE').combobox('getValues');
//当前页面中,盘点日期信息
var datestr = parseDate($("#PLAN_DATE").datebox("getValue")).format('yyyyMMdd')
if (datestr == "") {
MSI("提示", "请填写盘点日期信息!");
return false;
};
if (machinecode == "") {
MSI("提示", "请选择物料信息!");
return false;
};
//前台Grid表信息
var matData = $('#QDateGrid').datagrid('getData');
//当Grid表存在信息时
if (matData.rows.length > 0) {
for (var i = 0; i < matData.rows.length; i++)
{
var sendplanDetail = matData.rows[i];
for (var a = 1; a < machinecode.length; a++)
{
var materialList = machinecode;
var materialInfo = materialList[a];
if (sendplanDetail.MATERIAL_CODE == materialInfo)
{
MSI('提示', '已经添加了物料号为' + sendplanDetail.MATERIAL_CODE + '的物料信息!');
return false;
}
}
}
};
//*******************************提交************************************
var dataResultSubmit;
$.ajax({
url: "/StocktakingManage/AddMaterialDetail?MATERIAL_CODE=" + machinecode,
// data: {
// 'MATERIAL_CODE': $('#MATERIAL_CODE').combobox('getValue')
// },
type: "GET",
cache: false,
dataType: "json",
async: false,
success: function (data) {
//将后台传递过来的Json串转成对象
dataResultSubmit = eval(data);
}
});
//新增失败时
if (dataResultSubmit.IsSuccess == false) {
MSI("提示", dataResultSubmit.Msg);
return false;
}
//物料信息
for (var i = 0; i < dataResultSubmit.length; i++)
{
materialcode = dataResultSubmit[i].MATERIAL_CODE;
matrialtype = dataResultSubmit[i].MATERIAL_TYPE_CODE;
name = dataResultSubmit[i].CREATEUSERNAME;
date = dataResultSubmit[i].CreateDate;
//********************************填充数据****************************
matData.rows.push({
MATERIAL_CODE: materialcode,
MATERIAL_TYPE_CODE: matrialtype,
CREATEUSERNMAE: name,
CREATEDATE: date
});
$('#QDateGrid').datagrid('loadData', matData);
}
$('#addMaterialWindow').window('close');
}
//**************************************关闭新增物料信息********************************************
//关闭新增物料信息
function AddMaterialCancel() {
$('#addMaterialWindow').window('close');
}
//********************保物料信息******************************************
function SaveStocktingPlan() {
//Grid表信息
//当前页面中,盘点日期信息
var time = $("#PLAN_DATE").datebox("getValue");
if (time == "") {
MSI("提示", "请填写盘点日期信息!");
return false;
};
//当前页面中,有无条码
var counttype = $('#COUNTTYPE').combobox('getValue');
if (counttype == "") {
MSI("提示", "请选择有无条码信息!");
return false;
};
var matData = $('#QDateGrid').datagrid('getData');
//当Grid表存在信息时
if (matData.rows.length > 0) {
var materialCODE = "";
for (var i = 0; i < matData.rows.length; i++) {
var materialDetail = matData.rows[i];
materialCODE = materialCODE + ";" + materialDetail.MATERIAL_CODE;
}
//将物料id存到字符串中
//$("#EDITFLAG").val("1");
$('#MaterialCodes').val(materialCODE.substring(1));
submitByButton("StocktingPlanSave");
}
else {
MSI("提示", "请添加物料信息!");
return false;
}
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<%=Html.QTButtonSave("User", "Save", "return SaveStocktingPlan();")%>
<%=Html.QTButtonBack("close", "List", "parent.List(1);parent.closeAppWindow1();return false;")%>
</td>
</tr>
</table>
</asp:Content>