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

381 lines
13 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_GoodsMateList.aspx.cs" Inherits="TradeManage.CaiGou.CG_GoodsMateList" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>供应商</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var Id = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
ReadData();
$("#" + datagrid1.TableID + " input[CommandName='cmdEdit']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
//window.location.href = "CG_ChaseAdd.aspx?GoodsId=" + model.GoodsId;
Id = model.Id;
//$("#txtGYS").val(model.SupplierName);
$("#txtCGR").val(model.BuyerName);
$("#txtHWBH").val(model.GoodsOldCode);
fopen();
});
$("#btn_sch").bind("click", function () {
ReadData();
});
});
function AddMate()
{
Clear();
fopen();
}
function Clear()
{
Id = 0;
$("#txtCGR").val("");
$("#txtHWBH").val("");
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商";
col.CellTemplate = "<a>{Bind SupplierName}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购人";
col.CellTemplate = "<a>{Bind BuyerName}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号";
col.CellTemplate = "<span>{Bind GoodsOldCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物新编号";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<span>{Bind GoodsName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "分配日期";
col.CellTemplate = "<span>{Bind InDate,yyyy-MM-dd HH:mm}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "180px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;<input onclick='DelCol(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(30);
datagrid1.SetPageIndex(1);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.SupplierName = $("#txt_SupplierName").val();
param.Goods = $("#txt_goods").val();
param.Buyer = $("#txt_buyname").val();
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetListCG_GoodsMate",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
}
});
}
//#endregion
//#region 删除
function DelCol(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.Id = model.Id;
$.ajax({
url: "CaiGouService.asmx/DeleteBuyGoodsMate",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
function DelAll() {
if (window.confirm('确定要删除全部吗?') == false) return;
$.ajax({
url: "CaiGouService.asmx/DeleteAllBuyGoodsMate",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
function save() {
if ($("#txtSupplierName").val() == "") {
alert("请填写供应商名称");
return;
}
var param = new Object();
var model = new Object();
model.Id = Id;
model.BuyerName = $("#txtCGR").val();
model.GoodsCode = $("#txtHWBH").val();
param.Model = model;
$.ajax({
url: "CaiGouService.asmx/SaveBuyGoodsMate",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d ==-1)
{
alert("货物编号不存在");
return;
}
if (data.d == -2) {
alert("采购人不存在");
return;
}
alert("保存成功");
ReadData();
$.fancybox.close();
// window.location.href = "CG_Chase.aspx";
}
});
}
function saveGoodsMate() {
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/BuyGoodsMate",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
WindowLoadModel.Hide();
alert("完成");
ReadData();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="供应商" style="width:350px; height:200px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 110px;" class="f1">
采购人:
</td>
<td>
<input id="txtCGR" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
货物编号:
</td>
<td>
<input id="txtHWBH" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="保 存" onclick="save();"/>&nbsp;&nbsp;
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
采购货物分配</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="f1" width="13%">供应商:</td>
<td width="15%">
<input id="txt_SupplierName" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" width="13%">采购人:</td>
<td width="15%">
<input id="txt_buyname" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%;">货物:</td>
<td width="15%">
<input id="txt_goods" class="editTextbox" style="width: 120px;" type="text" /></td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr>
<td colspan="7">
<input id="btn_add" class="btnClass btnClassEdit" type="button" value="计算分配" onclick="saveGoodsMate();" /> <input id="btn_Delete" class="btnClass btnClassDel" type="button" value="删除之前分配" onclick="DelAll();"/>
<input class="btnClass btnClassAdd" type="button" value="新增" onclick="AddMate();" />
</td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</body>
</html>