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.

791 lines
28 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseNeed.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseNeed" %>
<!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/fancybox2.1/source/jquery.fancybox.css?v=2.1.5"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox2.1/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox2.1/source/jquery.fancybox.js?v=2.1.5"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
var Name = '<%= Session["Name"].ToString() %>';
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;
var Target = "";
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
Target = $.url.param("Target");
if (Target == undefined) {
Target = "";
}
$("#txt_BuyName").val(Name);
CreateDataGrid();
ReadData();
$("#" + datagrid1.TableID + " a[CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
if (Target == "")
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAddForTM.aspx?Title=采购批次&GoodsId=" + model.GoodsId, true);
else
window.open("../HuoWu/HW_GoodsAddForTM.aspx?Title=采购批次&GoodsId=" + model.GoodsId);
//window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAddForTM.aspx?Title=采购批次&GoodsId=" + model.GoodsId, true);
//window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAdd.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;
var SupplierId = 0;
if (model.Supplier != null)
SupplierId = model.Supplier;
var BuyUserId = 0
if (model.BuyUserId != null)
BuyUserId = model.BuyUserId;
window.open("CG_ChaseAddForTM.aspx?Title=采购参考&GoodsId=" + model.GoodsId + "&SupplierId=" + SupplierId + "&IsNeed=" + IsNeed + "&BuyUserId=" + BuyUserId);
// window.parent.addTab("新增采购", "CaiGou/CG_ChaseAddForTM.aspx?Title=采购参考&GoodsId=" + model.GoodsId + "&SupplierId=" + SupplierId + "&IsNeed=" + IsNeed + "&BuyUserId=" + BuyUserId, 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,#chk_IsNo").bind("click", function () {
ReadData();
});
$("#btn_sch3").bind("click", function () {
ReadData2();
});
});
//#region 读取分类
function Clearcss() {
IsNeed = 0;
IsSafe = 0;
$("#txt_Day").val("");
$("#btn_tj1,#btn_tj2,#btn_tj3,#btn_tj4").attr("class", "btnUnSelected");
}
function GetDepartMent() {
$("#select_dept").append("<option value='0'>全部</option>");
var param = new Object();
param.DeptType = "事业部";
WindowLoadModel.Show();
$.ajax({
url: "../SysManage/SysManageService.asmx/GetDepartList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function () {
$("#select_dept").append("<option value='" + this.DeptId + "'>" + this.DeptName + "</option>");
});
}
}
});
}
function GetBasePlat() {
$("#select_plat").append("<option value='0'>全部</option>");
var param = new Object();
param.CompanyID = 0;
param.KeyName = "ptlx";
WindowLoadModel.Show();
$.ajax({
url: "../UserService.asmx/GetPlatBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function () {
$("#select_plat").append("<option value='" + this.SortNo + "'>" + this.Name + "</option>");
});
GetShopList();
}
}
});
}
function GetShopList() {
$("#select_shop").empty();
$("#select_shop").append("<option value='0'>全部</option>");
var param = new Object();
param.DeptId = $("#select_dept").val();
param.PlatType = $("#select_plat").val();
WindowLoadModel.Show();
$.ajax({
url: "../BaseData.asmx/GetDeptShopList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function (i) {
$("#select_shop").append("<option value='" + this.ShopId + "'>" + this.ShopName + "</option>");
});
}
}
});
}
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();
}
});
}
function fopen3() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test2',
'onComplete': function () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind GoodsCode}</a>";
col.SortExpression = "GoodsCode";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<a>{Bind SKU1}</a>";
col.SortExpression = "GoodsCode";
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 = "明细描述";
col.CellTemplate = "<span class='ms'>{Bind TypeDesc}</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.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.SortExpression = " GoodsCode";
datagrid1.ViewSortDirection = "asc";
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid1.Init();
datagrid1.Sorting(function () {
ReadData();
});
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.GoodsCode = $("#txt_GoodsCode").val();
param.SKU = $("#txt_SKU").val();
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
param.Sort = datagrid1.SortExpression + " " + datagrid1.ViewSortDirection;
WindowLoadModel.Show();
$.ajax({
url: "../CaiGouServiceNew.asmx/GetListCGGoodsInfoNeedYW",
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);
}
});
}
function CountLeft() {
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetBuyLeft",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
var shtml = "";
$(data.d).each(function () {
shtml += this.Name + " " + this.Num + "<br/>"
});
$("#div_left").html(shtml);
}
}
});
}
function AddChase() {
var list = datagrid1.GetSelectListModel();
if (list == null) {
alert("请选择要采购的sku");
return;
}
var ids = "";
$(list).each(function () {
ids += this.DetailId + ",";
});
window.open("CG_ChaseAddForTM.aspx?DetailIds="+ids);
}
//#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 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 id="test2" title="货物图片" style="width:300px; height:280px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 80px;" class="f1">
采购剩余:
</td>
<td align="left"><div id="div_left">
</div>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input
id="btn_Cancel3" type="button" class="btnClass btnClassClose" value="关闭" />
</td>
</tr>
</table>
</div>
</div>
<table id="tb1" class="tableAll" style="width:100%;" >
<tr style="display:none">
<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" style="display:none">
<td colspan="7">
&nbsp;</td>
</tr>
<tr id="tr2">
<td class="f1" width="13%">货物名称/编号:</td>
<td width="15%">
<input id="txt_GoodsCode" class="editTextbox" style="width:120px;" type="text" /></td> <td class="f1" style="width:10%;">
SKU:</td>
<td width="15%">
<input id="txt_SKU" class="editTextbox" style="width:120px;"
type="text" /></td>
<td class="f1" style="width:10%; ">
&nbsp;</td>
<td width="25%"> &nbsp;</td>
<td><input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" />
</td>
</tr>
<tr id="tr7" >
<td colspan="7">
<input id="btn_add" class="btnClass btnClassAdd" type="button" value="选择货物生成采购" onclick="AddChase();" />
</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>