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.

532 lines
20 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsInfo.aspx.cs" Inherits="TradeManage.HuoWu.HW_GoodsInfo" %>
<!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/DateBox.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/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/jquery.cookies.min.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 src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
ReadData();
$("#" + datagrid1.TableID + " a[CommandName='cmdImg']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
if (model.GoodsImageIds != null && model.GoodsImageIds != "")
GetImage(model.GoodsImageIds);
});
$("#" + datagrid1.TableID + " a[CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
//window.location.href = "HW_GoodsAdd.aspx?GoodsId=" + model.GoodsId;
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAdd.aspx?Title=货物信息&GoodsId=" + model.GoodsId, true);
});
$("#" + 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 = "HW_GoodsAdd.aspx?GoodsId=" + model.GoodsId;
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAdd.aspx?Title=货物信息&GoodsId=" + model.GoodsId, true);
});
$("#cmdAdd").bind("click", function () {
var SelectListModels = datagrid1.GetSelectListModel();
if (SelectListModels == null || $(SelectListModels).length == 0) {
alert("请选择要开启或者关闭的评价");
return;
}
});
$("#div_img img").live("click", function () {
$("#img_1").attr("src", $(this).attr("src"));
});
$("#btn_sch").bind("click", function () {
ReadData();
});
$("#txt_snum,#txt_enum,#txt_sprice,#txt_eprice").MaskedTextBox();
$("#btn_add").bind("click", function () {
//window.location.href = "HW_GoodsAdd.aspx?GoodsId=0";
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAdd.aspx?Title=货物信息&GoodsId=0", true);
});
ReadSortList();
$("#btn_Cancel1").bind("click", $.fancybox.close);
$("#chk_iswh,#chk_hwmx,#chk_aqkc").bind("click", function () {
ReadData();
});
});
function AddTr() {
$("#" + datagrid1.TableID + " tr").each(function (i) {
if (i > 0) {
var shtmls = "<tr><td width='30px'><td colspan='10'>";
var index = $(this).attr("index");
var md = datagrid1.Get_Model(index);
if (md.GoodsList != null) {
$(md.GoodsList).each(function () {
shtmls += "<table width='80%' style='border:solid #add9c0; border-width:2px 0px 0px 2px;'><tr><td width='55%'><font color='blue'>明细编号:</font><span>" + this.TypeCode + "</span> &nbsp; &nbsp;<font color='blue'>SKU1</font><span>" + this.SKU1 + "</span> &nbsp; &nbsp;<font color='blue'>型号描述:</font>" + this.TypeDesc + "</td><td width='15%'><font color='blue'>库存:</font>" + this.GoodsNum + "</td><td width='15%'><font color='blue'>订单需求:</font>" + this.GoodsPlanNum + "</td><td width='15%'><font color='blue'>采购途中:</font>" + this.GoodsInNum + "</td></tr></table>";
});
}
shtmls += "</td><tr>";
$(this).after(shtmls);
}
});
}
//#region 读取分类
var ListSort = null;
function ReadSortList() {
ListSort = new Array();
$.ajax({
url: "HuoWuService.asmx/GetGoodsSortList",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: true,
success: function (data) {
ListSort = data.d;
BindTreeView();
ReadSortTree();
}
});
}
//#endregion
//#region 绑定
var TreeSource;
function BindTreeView() {
TreeSource = new Array();
// Treehtml = new Sys.StringBuilder();
var Sortslist = GetListSort(null);
$(Sortslist).each(function () {
var childNode = new Array();
var model = new Array();
model.id = this.SortId;
model.text = this.SortName;
model.state = "open";
model.checked = false;
model.iconCls = ".icon-addfolder";
model.children = childNode;
Array.add(TreeSource, model);
BindTreeChildNode(model.children, this.SortId);
});
}
//#endregion
//#region 绑定
function BindTreeChildNode(PrevNode, ParentItemId) {
var Sortslist = GetListSort(ParentItemId);
$(Sortslist).each(function () {
var atr = new Object();
var childNode = new Array();
var model = new Array();
model.id = this.SortId;
model.text = this.SortName;
model.iconCls = "icon-Tree";
model.state = "open";
model.checked = false;
model.children = childNode;
Array.add(PrevNode, model);
BindTreeChildNode(model.children, this.SortId);
});
}
//#endregion
//#region 返回指定级菜单
function GetListSort(ParentItemId) {
var Sortslist = new Array();
$(ListSort).each(function () {
if (this.ParentId == ParentItemId) {
var model = new Object();
model.SortId = this.SortId;
model.ParentId = this.ParentId;
model.SortName = this.SortName;
Array.add(Sortslist, model);
}
});
return Sortslist;
}
//#endregion
var SortId = 0;
function ReadSortTree() {
var model = new Array();
model.id = 0;
model.text = "-全部-";
model.state = "open";
model.checked = false;
model.iconCls = ".icon-addfolder";
model.children = null;
Array.insert(TreeSource, 0, model);
$("#txtSortId").combotree({
data: TreeSource,
onSelect: function (node) {
// var node = $("#txtSortId").tree("getSelected");
SortId = node.id;
}
});
}
function GetImage(Ids) {
$("#div_img").empty();
var param = new Object();
param.Ids = Ids;
$.ajax({
url: "../BaseData.asmx/GetResourceList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#img_1").attr("src", '../'+data.d[0].FileUrl);
$(data.d).each(function () {
$("#div_img").append("<img src='../" + this.FileUrl + "' width='100px' height='80px' style='margin-right:5px'/>");
});
fopen();
}
}
});
}
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 CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='40px' height='40px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编码";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind GoodsCode}</a>";
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 SortName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商";
col.CellTemplate = "<span>{Bind SupplierName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "进价RMB/件)";
col.CellTemplate = "<span>{Bind InPrice}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "重量";
col.CellTemplate = "<span>{Bind Weight}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "库存数量";
col.CellTemplate = "<span>{Bind GoodsNum}</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 = "150px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;&nbsp;<input CommandName='dgbtnDel' onclick='DelCol(this);' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(20);
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.SortId = SortId;
param.TypeCode = $("#select_yj").val();
param.Name = $("#txt_Name").val();
param.Supplier = $("#txt_gys").val();
if ($("#txt_snum").val() != "")
param.SNum = $("#txt_snum").val();
else
param.SNum = 0;
if ($("#txt_enum").val() != "")
param.ENum = $("#txt_enum").val();
else
param.ENum = 0;
if ($("#txt_sprice").val() != "")
param.SPrice = $("#txt_sprice").val();
else
param.SPrice = 0;
if ($("#txt_eprice").val() != "")
param.EPrice = $("#txt_eprice").val();
else
param.EPrice = 0;
param.IsQH = 0;
if ($("#chk_iswh").is(":checked") == true)
param.IsQH = 1;
param.IsHW = 0;
if ($("#chk_hwmx").is(":checked") == true)
param.IsHW = 1;
param.IsKC = 0;
if ($("#chk_aqkc").is(":checked") == true)
param.IsKC = 1;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
param.Sort = "GoodsId desc";
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetGoodsInfoList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
if ($("#chk_hwmx").is(":checked") == true)
AddTr();
}
});
}
//#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.GoodsId = model.GoodsId;
$.ajax({
url: "HuoWuService.asmx/DeleteGoodsInfo",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d == 0) {
alert("删除成功");
ReadData();
}
else
{
alert("该货物有库存或者有订单匹配或者有采购单匹配,无法删除");
}
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
货物信息
</div>
<div style="display: none">
<div id="test" title="货物图片" style="width: 600px; height: 400px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td colspan="2" align="center">
<img src="../attached/images/1.jpg" width="280px" height="250px" id="img_1" />
</td>
</tr>
<tr>
<td style="width: 80px;" class="f1">图片:
</td>
<td align="left">
<div id="div_img">
<img src="../attached/images/1.jpg" width="100px" height="80px" />
<img src="../attached/images/2.jpg" width="100px" height="80px" />
<img src="../attached/images/3.jpg" width="100px" height="80px" />
<img src="../attached/images/4.jpg" width="100px" height="80px" />
</div>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input
id="btn_Cancel1" type="button" class="btnClass btnClassClose" value="关闭" />
</td>
</tr>
</table>
</div>
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="f1" width="13%">&nbsp;类别:</td>
<td width="15%">
<select id="txtSortId" class="easyui-combobox" name="D4" style="width: 150px;">
</select></td>
<td class="f1" style="width: 10%;">价格:</td>
<td width="17%">
<input id="txt_sprice" min='0' max='1000000' precision='1' class="editTextbox" style="width: 50px;" type="text" />--<input id="txt_eprice" min='0' max='1000000' precision='1' class="editTextbox" style="width: 50px;" type="text" /></td>
<td style="width: 10%;">
<select id="select_yj" class="selectClass" style="width: 95px" name="D1">
<option value="2">货物编号</option>
<option value="4">货物SKU</option>
<option value="1">货物名称</option>
<option value="3">供应商货物编号</option>
</select></td>
<td width="15%">
<input id="txt_Name" class="editTextbox" style="width: 120px;" type="text" /></td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr>
<td class="f1" width="13%">供应商:</td>
<td>
<input id="txt_gys" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%; height: 15px;">库存数量:</td>
<td>
<input id="txt_snum" min='0' max='1000000' precision='0' class="editTextbox" style="width: 50px;" type="text" />--<input id="txt_enum" min='1' max='1000000' precision='0' class="editTextbox" style="width: 50px;" type="text" /></td>
<td colspan="3"> <input id="chk_hwmx" type="checkbox" checked="checked"/><label for="chk_hwmx">显示货物明细</label> <input id="chk_iswh" type="checkbox" /><label for="chk_iswh">显示无货</label>
<input id="chk_aqkc" type="checkbox" /><label for="chk_aqkc">显示低于安全库存</label></td>
</tr>
<tr>
<td colspan="7">
<input id="btn_add" class="btnClass btnClassAdd" type="button" value="新增" />
</td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</body>
</html>