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.

749 lines
29 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_Chase.aspx.cs" Inherits="TradeManage.CaiGou.CG_Chase" %>
<!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 type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
var WindowLoadModel = new WindowLoad();
var IsNeed = 1;
var IsSafe = 0;
var State = 1;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
CreateDataGrid2();
ReadSortList();
ReadData();
$("#Radio2").bind("click", function () {
$("#tr1,#tr2,#tr3,#tr4").hide();
$("#tr5,#tr6").show();
$("#tr7").hide();
$("#DataGrid1").hide();
$("#DataGrid2").show();
ReadData2();
});
$("#Radio1").bind("click", function () {
$("#tr1,#tr2,#tr3,#tr4").show();
$("#tr5,#tr6").hide();
$("#tr7").show();
$("#DataGrid2").hide();
$("#DataGrid1").show();
ReadData();
});
$("#" + datagrid1.TableID + " a[CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAddForTM.aspx?Look=Look&Title=采购参考&GoodsId=" + model.GoodsId + "&IsNeed=" + IsNeed, true);
// window.location.href = "../HuoWu/HW_GoodsAdd.aspx?Look=Look&GoodsId=" + model.GoodsId;
});
$("#" + datagrid1.TableID + " input[CommandName='cmdCK']").live("click", function () {
fopen2();
});
$("#" + datagrid1.TableID + " input[CommandName='cmdCG']").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;
window.parent.addTab("新增采购", "CaiGou/CG_ChaseAdd.aspx?Title=采购参考&GoodsId=" + model.GoodsId + "&IsNeed=" + IsNeed, true);
});
$("#" + datagrid2.TableID + " input[CommandName='cmdCG']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid2.Get_Model(RowIndex);
//window.location.href = "CG_ChaseAdd.aspx?GoodsId=" + model.GoodsId;
window.parent.addTab("新增采购", "CaiGou/CG_ChaseAdd.aspx?Title=采购参考&SupplierId=" + model.SupplierId + "&IsNeed=" + IsNeed, 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();
});
$("#btn_sch3").bind("click", function () {
ReadData2();
});
$("#btn_add").bind("click", function () {
// window.location.href = "CG_ChaseAdd.aspx?ChaseId=0";
window.parent.addTab("新增采购", "CaiGou/CG_ChaseAdd.aspx?Title=采购参考&GoodsId=0", true);
});
$("#btn_tj1").bind("click", function () {
Clearcss();
IsNeed = 1;
$(this).attr("class", "btnSelected");
ReadData();
});
$("#btn_tj2").bind("click", function () {
Clearcss();
IsNeed = 0;
$(this).attr("class", "btnSelected");
ReadData();
});
$("#btn_tj3").bind("click", function () {
Clearcss();
IsNeed = 0;
IsSafe = 1;
$(this).attr("class", "btnSelected");
ReadData();
});
$("#btn_tj4").bind("click", function () {
Clearcss();
IsNeed = 0;
$("#txt_Day").val("5");
$(this).attr("class", "btnSelected");
ReadData();
});
$("#btn_tj5").bind("click", function () {
$("#btn_tj6").attr("class", "btnUnSelected");
IsNeed = 1;
State = 1;
$(this).attr("class", "btnSelected");
ReadData2();
});
$("#btn_tj6").bind("click", function () {
$("#btn_tj5").attr("class", "btnUnSelected");
$(this).attr("class", "btnSelected");
IsNeed = 0;
State = 0;
ReadData2();
});
});
//#region 读取分类
function Clearcss() {
IsNeed = 0;
IsSafe = 0;
$("#txt_Day").val("");
$("#btn_tj1,#btn_tj2,#btn_tj3,#btn_tj4").attr("class", "btnUnSelected");
}
var ListSort = null;
function ReadSortList() {
ListSort = new Array();
$.ajax({
url: "../HuoWu/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;
}
});
}
//#region 读取数据
function GetHisGoods() {
if ($("#txt_ksrq").val() == "")
{
alert("请输入开始日期");
return;
}
if ($("#txt_jsrq").val() == "") {
alert("请输入结束日期");
return;
}
var param = new Object();
param.Sdate = $("#txt_ksrq").val();
param.Edate = $("#txt_jsrq").val();
WindowLoadModel.Show();
$.ajax({
url: "../DingDan/DD_OrderService.asmx/GetHisOrderGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null)
{
$("#a_ddnum").html(data.d.OrderNum + "个");
$("#a_xsnum").html(data.d.GoodsNum + "件");
}
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
function fopen2() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test1',
'onComplete': function () {
var date1 = new Date();
$("#txt_ksrq").val(date1.getFullYear()-1 + "-" + (date1.getMonth() + 1) + "-" + "01");
var day = new Date(date1.getFullYear()-1, (date1.getMonth() + 1), 0);
$("#txt_jsrq").val(date1.getFullYear()-1 + '-' + (date1.getMonth() + 1) + '-' + day.getDate());//获取当月最后一天日期);
GetHisGoods();
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var 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 = "<a>{Bind GoodsName}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<span>{Bind SKU1}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "明细描述";
col.CellTemplate = "<span>{Bind TypeDesc}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商";
col.CellTemplate = "<span>{Bind SupplierId}</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 GoodsPlanNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买在途";
col.CellTemplate = "<span>{Bind GoodsInNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "剩余参考";
col.CellTemplate = "<span>{Bind LeftNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "安全库存";
col.CellTemplate = "<span>{Bind SafeNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "最近一个月销量";
col.Align = "left";
col.CellTemplate = "<span style='width:40px;display:inline-block;display:-moz-inline-box;'>{Bind GoodsOutNum}</span><input CommandName='cmdCK' class='btnClass dgbtnView' type='button' value='去年同期参考'></input>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "150px";
col.CellTemplate = "<input CommandName='cmdCG' class='btnClass dgbtnEdit' 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(); });
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商名称";
col.CellTemplate = "<a class='linka'>{Bind SupplierName}</a>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "联系人";
col.CellTemplate = "<a class='linka'>{Bind Person}</a>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "联系方式";
col.CellTemplate = "<span>{Bind Mobile}/{Bind Phone}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "信用等级";
col.CellTemplate = "<span>{Bind Credit}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "需采购物品类数";
col.CellTemplate = "<span>{Bind GoodsNum}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "150px";
col.CellTemplate = "<input CommandName='cmdCG' class='btnClass dgbtnEdit' type='button' value='采购'></input>";
Array.add(datagrid2.Columns, col);
datagrid2.SetPageSize(30);
datagrid2.SetPageIndex(1);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = true;
datagrid2.Width = "100%";
datagrid2.SelectMode = nblf.ui.SelectMode.None;
datagrid2.Init();
datagrid2.add_PageIndexChanged(function () { ReadData2(); });
}
var SortId=0;
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.SortId=SortId;
param.GoodsCode = $("#txt_GoodsCode").val();
param.SKU = $("#txt_SKU").val();
param.Supplier = $("#txt_Supplier").val();
param.SNum = -1;
if ($("#txt_SNum").val() != "")
param.SNum = $("#txt_SNum").val();
param.ENum =-1;
if ($("#txt_ENum").val() != "")
param.ENum = $("#txt_ENum").val();
param.SCKNum =-1;
if ($("#txt_SCKNum").val() != "")
param.SCKNum = $("#txt_SCKNum").val();
param.ECKNum = -1;
if ($("#txt_ECKNum").val() != "")
param.ECKNum = $("#txt_ECKNum").val();
param.IsAQKC = IsSafe
if ($("#txt_Day").val()!="")
param.IsDays = $("#txt_Day").val();
else
param.IsDays = 0;
param.IsXYCG = IsNeed;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
param.Sort = "GoodsCode,TypeCode";
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetListCGGoodsInfo",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
}
});
}
function ReadData2() {
var param = new Object();
param.State = State;
param.GoodsCode = $("#txt_GoodsName").val();
//param.SKU = $("#txt_GoodsSku").val();
param.Supplier = $("#txt_SupplierName").val();
param.PageSize = datagrid2.Get_PageSize();
param.PageIndex = datagrid2.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetListJC_CGSupplier",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid2.Set_RowCount(data.d.RowCount);
datagrid2.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: "YY_Service.asmx/DeleteFoodList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
}
});
ReadData();
}
function ExportData() {
var dd = new Date();
var fname = "采购参考(" + dd.getFullYear() + "." + (dd.getMonth() + 1) + "." + dd.getDate() + ").xls";
$.ajax({
url: "CaiGouService.asmx/ExcelChaseData",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
params = { FilePath: data.d, FileName: fname };
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<form>
<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" value="关闭" />
</td>
</tr>
</table>
</div>
</div>
<div style="display: none">
<div id="test1" title="历年同期" style="width:450px; height:200px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td width="70px" class="f1">日期:
</td><td colspan="3"> <input id="txt_ksrq" class="editTextbox" onfocus="WdatePicker()" style="width:120px;" type="text" />-<input id="txt_jsrq" class="editTextbox" onfocus="WdatePicker()" style="width:120px;" type="text" /><input id="btn_sch2" class="btnClass btnClassFind" onclick="GetHisGoods();" type="button" value="查询" />
</td>
</tr>
<tr>
<td width="70px" class="f1">订单数:
</td> <td><a id="a_ddnum"></a>
</td> <td width="70px" class="f1">销售量:
</td> <td><a id="a_xsnum"></a>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<input
id="btn_Cancel2" type="button" class="btnClass btnClassClose" value="关闭" />
</td>
</tr>
</table>
</div>
</div>
<table id="tb1" class="tableAll" style="width:100%;" >
<tr>
<td colspan="7">
<font color="red">注:剩余参考=【当前库存+货物采购途中-订单需求】</font></td>
</tr>
<tr>
<td colspan="7">
<input id="Radio1" checked="checked" name="cg" type="radio" /><label>按货物采购</label><input id="Radio2" name="cg" type="radio" /><label>按供应商采购</label></td>
</tr>
<tr id="tr1">
<td colspan="7">
<input id="btn_tj1" type="button" value="订单缺货的货物" class="btnSelected"/> <input id="btn_tj2" class="btnUnSelected" type="button" value="全部货物" /> <input id="btn_tj3" class="btnUnSelected" type="button" value="低于安全库存" /> <input id="btn_tj4" class="btnUnSelected" type="button" value="即将缺货货物" /></td>
</tr>
<tr id="tr2">
<td class="f1" width="13%">货物类别:</td>
<td width="15%">
<select id="txtSortId" class="easyui-combobox" name="D4" style="width: 120px;">
</select>
</td> <td class="f1" style="width:10%;">
货物名称/代码:</td>
<td width="15%">
<input id="txt_GoodsCode" class="editTextbox" style="width:120px;" type="text" /></td>
<td class="f1" style="width:10%; ">
剩余参考:</td>
<td width="15%">
<input id="txt_SNum" class="editTextbox" style="width:50px;" type="text" />--<input id="txt_ENum" class="editTextbox" style="width:50px;" type="text" /></td>
<td><input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" />
</td>
</tr>
<tr id="tr3">
<td class="f1" width="13%">供应商:</td>
<td>
<input id="txt_Supplier" class="editTextbox" style="width:120px;" type="text" /></td> <td class="f1" style="width:10%; height: 15px;">
型号描述/SKU:</td>
<td>
<input id="txt_SKU" class="editTextbox" style="width:120px;" type="text" /></td> <td class="f1" style="width:10%; height: 15px;">
库存数量:</td>
<td>
<input id="txt_SCKNum" class="editTextbox" style="width:50px;" type="text" />--<input id="txt_ECKNum" class="editTextbox" style="width:50px;" type="text" /></td>
<td>
</td>
</tr>
<tr id="tr4">
<td colspan="7">按最近一个月销量计算:显示库存量小于等于<input id="txt_Day" class="editTextbox" style="width:50px;" type="text" value=""/>天销售的货物</td>
</tr>
<tr id="tr5" style="display:none">
<td colspan="7">
<input id="btn_tj5" class="btnSelected" type="button" value="有货物要采购的供应商" />
<input id="btn_tj6" class="btnUnSelected" type="button" value="全部供应商" />&nbsp; </td>
</tr>
<tr id="tr6" style="display:none">
<td class="f1" width="13%">供应商:</td>
<td>
<input id="txt_SupplierName" class="editTextbox" style="width:120px;" type="text" /></td> <td class="f1" style="width:10%; height: 15px;">
货物名称/代码/SKU:</td>
<td>
<input id="txt_GoodsName" class="editTextbox" style="width:120px;" type="text" /></td>
<td colspan="3">
<input id="btn_sch3" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr id="tr7" >
<td colspan="7">
<input id="btn_add" class="btnClass btnClassAdd" type="button" value="新增采购" />
<input id="cmdOut" class="btnClass btnClassExcelTemplate" onclick="ExportData();" type="button" value="导出需要购买货物" />
</td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
<div id="DataGrid2" class="DataGridStyle" style="display:none"></div>
</td>
</tr>
</table>
</form>
</body>
</html>