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.

693 lines
26 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsPlanCount.aspx.cs" Inherits="TradeManageNew.Huowu.HW_GoodsPlanCount" %>
<!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/FixTable.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global2.js?t=1" 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 src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script type="text/javascript">
var Name = '<%= Session["Name"].ToString() %>';
var UserId = '<%= Session["UserId"].ToString() %>';
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var DId = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
ReadGroup();
ReadUser();
ReadData();
$("#select_groupname").bind("change", function () {
ReadUser();
ReadData();
});
$("#" + datagrid1.TableID + " a[CommandName='dgbtnKC']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
var DId = model.Id;
$("#txt_OutDays2").val(model.OutDays2);
$("#txt_Price").val(model.Price);
$("#txt_Price2").val(model.Price2);
$("#txt_Num").val(model.Num);
$("#txt_Price3").val(model.Price3);
$("#txt_Num2").val(model.Num2);
$("#txt_Price4").val(model.Price4);
$("#txt_PlanInfo").val(model.PlanInfo);
$("#txt_AdviseInfo").val(model.AdviseInfo);
$("#txt_Remark").val(model.Remark);
fopen();
Model = model;
var snames = model.ShopNames;
ReadShopList(snames);
});
});
function ReadGroup() {
if(UserId==1||UserId==51||UserId==53)
$("#select_groupname").append("<option value='-1'>全部</option>");
$.ajax({
url: "../SysManageServiceNew.asmx/GetListUserInfoFromGroup",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
$(data.d).each(function () {
$("#select_groupname").append("<option value='" + this.UserId + "'>" + this.Name + "</option>");
});
}
});
}
function ReadUser() {
$("#select_name").empty();
if(UserId==1||UserId==51||UserId==53)
$("#select_name").append("<option value=''>全部</option>");
var param = new Object();
param.groupid = $("#select_groupname").val();
$.ajax({
url: "../SysManageServiceNew.asmx/GetListUserInfoFromGroup3",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
$(data.d).each(function () {
//if(UserId!=1&&UserId!=51&&this.UserId==UserId&&UserId!=53)
// $("#select_name").append("<option value='" + this.UserId + "'>" + this.Name + "</option>");
// else
// if(UserId==1||UserId==51||UserId==53)
$("#select_name").append("<option value='" + this.UserId + "'>" + this.Name + "</option>");
});
if(UserId!=1&&UserId!=51&&UserId!=53)
$("#select_name").val(UserId);
}
});
}
//#region 读取分类
function ReadShopList(ShopNames) {
$("#div_shopnames").empty();
var param = new Object();
param.ShopNames = ShopNames;
$.ajax({
url: "../HuoWuServiceNew.asmx/GetZTShopList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: true,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
if (this.IsCheck == true)
$("#div_shopnames").append("<input spid='" + this.ShopId + "' sname='" + this.ShopName + "' type='checkbox' checked='checked'/>"+this.ShopName);
else
$("#div_shopnames").append("<input spid='"+this.ShopId+"' sname='" + this.ShopName + "' type='checkbox' />"+this.ShopName);
});
}
}
});
}
//#endregion
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 () {
}
});
}
//#region 初始化DataGrid
function CreateDataGrid() {
Array.clear(datagrid1.Columns);
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "缩略图";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物SKU";
col.Width = "150px";
col.Align = "left";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind SKU1}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "人员";
col.CellTemplate = "<div>{Bind mname}</div>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "组长";
col.CellTemplate = "<div>{Bind groupname}</div>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "最长出单周期(天)";
col.CellTemplate = "<span>{Bind OutDays2}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "前期定价$";
col.CellTemplate = "<span>{Bind Price}</span>";
// col.SortExpression = "InPrice";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "稳定定价";
col.CellTemplate = "<span>{Bind Price2}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "第一名销量";
col.CellTemplate = "<span>{Bind Num}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "定价$";
col.CellTemplate = "<span>{Bind Price3}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "目标销量";
col.CellTemplate = "<span>{Bind Num2}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "定价$";
col.CellTemplate = "<span>{Bind Price4}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "重推店铺";
col.CellTemplate = "<div>{Bind ShopNames}</div>";
col.Width = "150px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "计划";
col.CellTemplate = "<div>{Bind PlanInfo}</div>";
col.Width = "150px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "要求";
col.CellTemplate = "<div>{Bind AdviseInfo}</div>";
col.Width = "150px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "备注";
col.CellTemplate = "<div>{Bind Remark}</div>";
col.Width = "150px";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "周销量 | 金额";
col.CellTemplate = "<span>{Bind GoodsWeekHJNum}|{Bind GoodsWeekHJPrice}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "月销量|金额";
col.CellTemplate = "<span>{Bind GoodsHJNum2}|{Bind GoodsMonthHJPrice}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "未出单天数(天)";
col.CellTemplate = "<span GNum='{Bind NoOutDays}' SNum='{Bind OutDays2}'>{Bind NoOutDays}</span>";
// col.SortExpression = "b.GoodsInNum";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "80px";
col.CellTemplate = "<a CommandName='dgbtnKC' style='color: #23527c;cursor:pointer'>填写</a>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(20);
datagrid1.SetPageIndex(1);
// datagrid1.SortExpression = "b.GoodsCode,b.Indate";
// datagrid1.ViewSortDirection = "ASC";
datagrid1.IsFixHeader = true;
datagrid1.Height = $(document).height() - 230;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
//datagrid1.Sorting(function () {
// ReadData();
//});
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
function AddTr() {
$("span[GNum]").each(function () {
var GNum = $(this).attr("GNum");
var SNum = $(this).attr("SNum");
if (GNum == "")
GNum = 0;
if (SNum == "")
SNum = 0;
if (SNum>0&&parseInt(GNum) >parseInt(SNum)) {
$(this).css("color", "red");
}
});
//$("tr[name='DataGridRow']").each(function (i) {
// if (i % 2 == 0)
// $(this).css("background-color", "#EEEEEE");
// ;
//});
}
function ReadData() {
$("#_fixTableHeader").show();
var param = new Object();
CreateWhere("SelectHtml", param); //读取查询条件
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
param.cs += " and b.State=1 and d.deptid=1 and d.state=1 and a.SKU1 not like 's-%' ";
param.cs = Base64.encode(param.cs);
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/GetListGoodsUserPlanCount",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
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("该货物有库存或者有订单匹配或者有采购单匹配,无法删除");
}
}
});
}
function UpdateGoodsSafeNum() {
datagrid2.UpdateDataSource();
var param = new Object();
param.list = datagrid2.DataSource;
$.ajax({
url: "HuoWuService.asmx/UpdateGoodsSafeNum",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("备货成功");
ReadData();
$.fancybox.close();
}
});
}
var Model = null;
function Save() {
var param = new Object();
Model.DetailId = Model.Id;
Model.Id = 0;
if( $("#txt_OutDays2").val()!="")
Model.OutDays2 = $("#txt_OutDays2").val();
if( $("#txt_Price").val()!="")
Model.Price = $("#txt_Price").val();
if( $("#txt_Price2").val()!="")
Model.Price2 = $("#txt_Price2").val();
if( $("#txt_Price3").val()!="")
Model.Price3 = $("#txt_Price3").val();
if( $("#txt_Price4").val()!="")
Model.Price4 = $("#txt_Price4").val();
if( $("#txt_Num").val()!="")
Model.Num = $("#txt_Num").val();
if( $("#txt_Num2").val()!="")
Model.Num2 = $("#txt_Num2").val();
Model.PlanInfo=$("#txt_PlanInfo").val();
Model.AdviseInfo=$("#txt_AdviseInfo").val();
Model.Remark = $("#txt_Remark").val();
var snames = "";
$("input[spid]").each(function () {
if ($(this).is(":checked") == true)
snames += $(this).attr("sname")+",";
});
Model.ShopNames = snames;
param.Model =Model;
$.ajax({
url: "../HuoWuServiceNew.asmx/Save_GoodsUserPlanCount",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("保存成功");
$.fancybox.close();
ReadData();
}
});
}
function SaveXP() {
var list = datagrid4.GetSelectListModel();
if (list == null || list.length == 0) {
alert("请选择一个货物");
return;
}
if (list[0].IsAdd == 1) {
alert("该选品货物已经添加过编号,不能新增");
return;
}
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAddForTM.aspx?Title=货物信息&GoodsId=0&XPId=" + list[0].Id + "&LinkUrl=" + list[0].LinkUrl, true);
}
function DeleteXP() {
var list = datagrid4.GetSelectListModel();
if (list == null || list.length == 0) {
alert("请选择一个货物");
return;
}
if (window.confirm('确定要删除该记录吗?') == false) return;
var param = new Object();
param.Id = list[0].Id;
$.ajax({
url: "../BaseData.asmx/DeleteXP",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
function SyncPrice() {
var price = 0;
$("input[ColName='Price']").each(function () {
if (price == 0 && $(this).val() != "")
price = $(this).val();
});
if (price > 0)
$("input[ColName='Price']").val(price);
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
货物SKU</div>
<div style="display: none">
<div id="test" title="" style="width: 550px; height: 400px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td class="f1" width="15%">
最长出单周期:
</td>
<td colspan="3">
<input id="txt_OutDays2" class="editTextbox" style="width: 120px;"
type="text" />天
</td>
</tr>
<tr>
<td class="f1" width="15%">
前期定价:
</td>
<td>
<input id="txt_Price" class="editTextbox" style="width: 120px;" type="text" />$
</td>
<td class="f1" width="15%">
稳定定价:
</td>
<td>
<input id="txt_Price2" class="editTextbox" style="width: 120px;"
type="text" />$
</td>
</tr>
<tr>
<td class="f1" width="15%">
第一名销量:
</td>
<td>
<input id="txt_Num" class="editTextbox" style="width: 120px;" type="text" />
</td>
<td class="f1" width="15%">
定价:
</td>
<td>
<input id="txt_Price3" class="editTextbox" style="width: 120px;"
type="text" />$
</td>
</tr>
<tr>
<td class="f1" width="15%">
目标销量:
</td>
<td>
<input id="txt_Num2" class="editTextbox" style="width: 120px;" type="text" />
</td>
<td class="f1" width="15%">
定价:
</td>
<td>
<input id="txt_Price4" class="editTextbox" style="width: 120px;"
type="text" />$
</td>
</tr>
<tr>
<td class="f1" width="15%">
重推店铺:
</td>
<td colspan="3">
<div id="div_shopnames"></div>
</td>
</tr>
<tr>
<td class="f1" width="15%">
计划:
</td>
<td colspan="3">
<textarea id="txt_PlanInfo" cols="20" style="width:99%" rows="3"></textarea>
</td>
</tr>
<tr>
<td class="f1" width="15%">
要求:
</td>
<td colspan="3">
<textarea id="txt_AdviseInfo" cols="20" style="width:99%" rows="3"></textarea>
</td>
</tr>
<tr>
<td class="f1" width="15%">
备注:
</td>
<td colspan="3">
<textarea id="txt_Remark" cols="20" rows="3" style="width:99%"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<input id="btn_Save4" type="button" class="btnClass btnClassSave" value="确 定" onclick="Save();" />
</td>
</tr>
</table>
</div>
</div>
<table id="SelectHtml" class="tableAll" style="width: 100%;">
<tr>
<td class="f1">
SKU:
</td>
<td style="width:30%">
<input id="txt_Name" class="editTextbox" style="width: 120px;" type="text" where="a.SKU1 like '%@value%'"/>
</td>
<td class="f1">
分组/人员:
</td>
<td style="width:30%">
<select id="select_groupname" class="selectClass" style="width: 120px" name="D2" where="d.guserid=@value">
</select>组<select id="select_name" class="selectClass" style="width: 120px" name="D1" where="b.muserid=@value">
</select></td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" onclick="ReadData();" />
</td>
</tr>
<tr>
<td class="f1">
未出单天数:</td>
<td style="width:30%">
<input id="txt_SNum" class="editTextbox" style="width: 50px;" type="text" where="DATEDIFF(day,b.LastOrderDate,GETDATE())>=@value"/>-<input id="txt_ENum" class="editTextbox" style="width: 50px;" type="text" where="DATEDIFF(day,b.LastOrderDate,GETDATE())<=@value"/></td>
<td class="f1">
&nbsp;</td>
<td style="width:30%">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td valign="top" colspan="5">
<div id="DataGrid1" class="DataGridStyle" style="-webkit-overflow-scrolling: touch;
overflow: auto;">
</div>
</td>
</tr>
</table>
</body>
</html>