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.
1004 lines
39 KiB
Plaintext
1004 lines
39 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsUserApply.aspx.cs"
|
|
Inherits="TradeManageNew.CangKu.HW_GoodsUserApply" %>
|
|
|
|
<!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/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/ajaxfileupload.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 datagrid1 = new nblf.ui.DataGrid("DataGrid1");
|
|
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
|
|
var datagrid3 = new nblf.ui.DataGrid("DataGrid3");
|
|
var WindowLoadModel = new WindowLoad();
|
|
var GoodsId = 0;
|
|
$(document).ready(function () {
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
WindowLoadModel.Isbgiframe = true;
|
|
WindowLoadModel.Load();
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
CreateDataGrid();
|
|
|
|
GetStore();
|
|
GetShop();
|
|
CreateDataGrid2();
|
|
CreateDataGrid3();
|
|
|
|
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);
|
|
|
|
|
|
|
|
});
|
|
$("#DataGrid3 [CommandName]").live("click", function () {
|
|
var CommandName = $(this).attr("CommandName");
|
|
var index = $(this).parentsUntil("tr").parent().attr("index");
|
|
Model = datagrid3.Get_Model(index);
|
|
|
|
if (CommandName == "cmdDel") {
|
|
if (SelectList != null) {
|
|
$(SelectList).each(function () {
|
|
if (this.DetailId == Model.DetailId && this.StoreId == Model.StoreId) {
|
|
$("#DataGrid2 input[did=" + this.DetailId + "]").val('');
|
|
Array.remove(SelectList, this);
|
|
}
|
|
});
|
|
}
|
|
|
|
datagrid3.Del_Row(index);
|
|
}
|
|
});
|
|
$("#btn_Add").bind("click", function () {
|
|
|
|
ShowFancybox("test");
|
|
|
|
});
|
|
$("#btn_Sch1").bind("click", function () {
|
|
|
|
ReadGoods();
|
|
|
|
});
|
|
$("#btn_Sch").bind("click", function () {
|
|
|
|
ReadData();
|
|
|
|
});
|
|
|
|
$("#btn_import").click(function () {
|
|
|
|
ajaxFileUpload();
|
|
});
|
|
});
|
|
|
|
//#region 显示弹出窗体
|
|
function ShowFancybox(id) {
|
|
$.fancybox({
|
|
'scrolling': 'no',
|
|
'autoScale': false,
|
|
'transitionIn': 'elastic',
|
|
'transitionOut': 'elastic',
|
|
'href': '#' + id,
|
|
'onClosed': function () {
|
|
|
|
}
|
|
}, 0);
|
|
}
|
|
//#endregion
|
|
function GetStore() {
|
|
|
|
|
|
//var param = new Object();
|
|
//param.StoreId = StoreId;
|
|
|
|
$.ajax({
|
|
url: "CK_Service.asmx/GetUseStoreHouse",
|
|
async: false,
|
|
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
if (data.d != null) {
|
|
$(data.d).each(function () {
|
|
// $("#select_ck1").append("<option value='" + this.StoreId + "'>" + this.StoreName + "</option>");
|
|
$("#select_store,#select_store2").append("<option value='" + this.StoreId + "'>" + this.StoreName + "</option>");
|
|
});
|
|
|
|
}
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
var slist;
|
|
function GetShop() {
|
|
|
|
|
|
//var param = new Object();
|
|
//param.StoreId = StoreId;
|
|
|
|
$.ajax({
|
|
url: "CK_Service.asmx/GetMyShop",
|
|
async: false,
|
|
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
slist = data.d;
|
|
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
//#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 初始化DataGrid
|
|
function CreateDataGrid2() {
|
|
|
|
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(datagrid2.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "仓库";
|
|
col.CellTemplate = "<a>{Bind StoreName}</a>";
|
|
Array.add(datagrid2.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "货物SKU";
|
|
col.Width = "180px";
|
|
col.Align = "left";
|
|
col.CellTemplate = "<a>{Bind GoodsCode}【{Bind SKU}】</a><br/><span>{Bind GoodsName}</span>";
|
|
Array.add(datagrid2.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "当前库存";
|
|
col.Width = "90px";
|
|
col.CellTemplate = "<span>{Bind KCNum}</span>";
|
|
//col.SortExpression = "b.GoodsNum";
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "剩余认购数";
|
|
col.CellTemplate = "<span>{Bind LeftNum}</span>";
|
|
// col.SortExpression = "b.GoodsInNum";
|
|
Array.add(datagrid2.Columns, col);
|
|
$(slist).each(function (i) {
|
|
|
|
i = i + 1;
|
|
if (i < 16) {
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = this.ShopName;
|
|
|
|
var row = "Num" + i.toString();
|
|
col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:50px;' did='{Bind DetailId}' gcode='{Bind SKU}' sip='" + this.ShopId + "' storeid='{Bind StoreId}' sname='" + this.ShopName + "' class='editTextbox' ColName='" + row + "' value='{Bind " + row + "}' />";
|
|
Array.add(datagrid2.Columns, col);
|
|
}
|
|
|
|
});
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺1认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺2认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺3认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺4认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺5认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "店铺6认购数";
|
|
// col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}' />";
|
|
// Array.add(datagrid2.Columns, col);
|
|
|
|
datagrid2.SetPageSize(8);
|
|
datagrid2.SetPageIndex(1);
|
|
// datagrid1.SortExpression = "b.GoodsCode,b.Indate";
|
|
// datagrid1.ViewSortDirection = "ASC";
|
|
// datagrid2.IsFixHeader = true;
|
|
// datagrid2.Height =500;
|
|
datagrid2.ShowIndexColumn = false;
|
|
datagrid2.AllowPaging = true;
|
|
datagrid2.Width = "100%";
|
|
//datagrid1.Sorting(function () {
|
|
// ReadData();
|
|
//});
|
|
datagrid2.SelectMode = nblf.ui.SelectMode.None;
|
|
datagrid2.Init();
|
|
datagrid2.add_PageIndexChanged(function () { AddGoods2(); ReadGoods(); });
|
|
|
|
}
|
|
//#region 读取数据
|
|
|
|
function ReadGoods() {
|
|
var param = new Object();
|
|
param.ShopId = 0;
|
|
param.StoreId = $("#select_store").val();
|
|
param.Type = 1;
|
|
if ($("#rad_tx2").is(":checked") == true)
|
|
param.Type = 2;
|
|
param.StoreName = $("#select_store").find("option:selected").text();
|
|
|
|
param.Num = 1;
|
|
param.GoodsName = $("#txt_Name").val();
|
|
|
|
param.PageSize = datagrid2.Get_PageSize();
|
|
param.PageIndex = datagrid2.Get_PageIndex();
|
|
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "CK_Service.asmx/GetGoodsUserList",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
datagrid2.Set_RowCount(data.d.RowCount);
|
|
datagrid2.DataBind(data.d.DataSource);
|
|
if (SelectList != null) {
|
|
$(SelectList).each(function () {
|
|
var did = this.DetailId;
|
|
var storeid = this.StoreId;
|
|
var Num1 = this.Num1;
|
|
var Num2 = this.Num2;
|
|
var Num3 = this.Num3;
|
|
var Num4 = this.Num4;
|
|
var Num5 = this.Num5;
|
|
var Num6 = this.Num6;
|
|
var Num7 = this.Num7;
|
|
var Num8 = this.Num8;
|
|
var Num9 = this.Num9;
|
|
var Num10 = this.Num10;
|
|
var Num11 = this.Num11;
|
|
var Num12 = this.Num12;
|
|
var Num13 = this.Num13;
|
|
var Num14 = this.Num14;
|
|
var Num15 = this.Num15;
|
|
$("#DataGrid2 input[did]").each(function () {
|
|
var did2 = $(this).attr("did");
|
|
var storeid2 = $(this).attr("storeid");
|
|
if (did2 == did && storeid == storeid2) {
|
|
if ($(this).attr("ColName") == "Num1")
|
|
$(this).val(Num1);
|
|
if ($(this).attr("ColName") == "Num2")
|
|
$(this).val(Num2);
|
|
if ($(this).attr("ColName") == "Num3")
|
|
$(this).val(Num3);
|
|
if ($(this).attr("ColName") == "Num4")
|
|
$(this).val(Num4);
|
|
if ($(this).attr("ColName") == "Num5")
|
|
$(this).val(Num5);
|
|
if ($(this).attr("ColName") == "Num6")
|
|
$(this).val(Num6);
|
|
if ($(this).attr("ColName") == "Num7")
|
|
$(this).val(Num7);
|
|
if ($(this).attr("ColName") == "Num8")
|
|
$(this).val(Num8);
|
|
if ($(this).attr("ColName") == "Num9")
|
|
$(this).val(Num9);
|
|
if ($(this).attr("ColName") == "Num10")
|
|
$(this).val(Num10);
|
|
|
|
if ($(this).attr("ColName") == "Num11")
|
|
$(this).val(Num11);
|
|
|
|
if ($(this).attr("ColName") == "Num12")
|
|
$(this).val(Num12);
|
|
|
|
if ($(this).attr("ColName") == "Num13")
|
|
$(this).val(Num13);
|
|
|
|
if ($(this).attr("ColName") == "Num14")
|
|
$(this).val(Num14);
|
|
|
|
if ($(this).attr("ColName") == "Num15")
|
|
$(this).val(Num15);
|
|
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
function AddGoods() {
|
|
|
|
if (SelectList == null)
|
|
SelectList = new Array();
|
|
|
|
datagrid2.UpdateDataSource();
|
|
|
|
$(datagrid2.DataSource).each(function () {
|
|
var storeid = this.StoreId;
|
|
var did = this.DetailId;
|
|
if (this.Num1 > 0 || this.Num2 > 0 || this.Num3 > 0 || this.Num4 > 0 || this.Num5 > 0 || this.Num6> 0 || this.Num7 > 0 || this.Num8> 0 || this.Num9 > 0 || this.Num10 > 0 || this.Num11 > 0 || this.Num12 > 0 || this.Num13 > 0 || this.Num14 > 0 || this.Num15 > 0) {
|
|
|
|
var iscz = 0;
|
|
var Num1 = this.Num1;
|
|
var Num2 = this.Num2;
|
|
var Num3 = this.Num3;
|
|
var Num4 = this.Num4;
|
|
var Num5 = this.Num5;
|
|
var Num6= this.Num6;
|
|
var Num7 = this.Num7;
|
|
var Num8 = this.Num8;
|
|
var Num9 = this.Num9;
|
|
var Num10 = this.Num10;
|
|
var Num11 = this.Num11;
|
|
var Num12 = this.Num12;
|
|
var Num13 = this.Num13;
|
|
var Num14 = this.Num14;
|
|
var Num15 = this.Num15;
|
|
$(SelectList).each(function () {
|
|
if (did == this.DetailId && storeid == this.StoreId) {
|
|
iscz = 1;
|
|
this.Num1 = Num1;
|
|
this.Num2 = Num2;
|
|
this.Num3 = Num3;
|
|
this.Num4 = Num4;
|
|
this.Num5 = Num5;
|
|
this.Num6 = Num6;
|
|
this.Num7= Num7;
|
|
this.Num8= Num8;
|
|
this.Num9 = Num9;
|
|
this.Num10 = Num10;
|
|
this.Num11 = Num11;
|
|
this.Num12= Num12;
|
|
this.Num13= Num13;
|
|
this.Num14 = Num14;
|
|
this.Num15 = Num15;
|
|
}
|
|
|
|
});
|
|
if (iscz == 0)
|
|
Array.add(SelectList, this);
|
|
|
|
}
|
|
else {
|
|
|
|
var did = this.DetailId;
|
|
|
|
$(SelectList).each(function () {
|
|
if (did == this.DetailId && storeid==this.StoreId)
|
|
Array.remove(SelectList, this);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
datagrid3.DataBind(SelectList);
|
|
$("input[max]").MaskedTextBox();
|
|
$.fancybox.close();
|
|
}
|
|
|
|
function AddGoods2() {
|
|
|
|
if (SelectList == null)
|
|
SelectList = new Array();
|
|
|
|
datagrid2.UpdateDataSource();
|
|
|
|
$(datagrid2.DataSource).each(function () {
|
|
var did = this.DetailId;
|
|
var storeid = this.StoreId;
|
|
if (this.Num1 > 0 || this.Num2 > 0 || this.Num3 > 0 || this.Num4 > 0 || this.Num5 > 0 || this.Num6 > 0 || this.Num7 > 0 || this.Num8 > 0 || this.Num9 > 0 || this.Num10 > 0 || this.Num11 > 0 || this.Num12 > 0 || this.Num13 > 0 || this.Num14 > 0 || this.Num15 > 0) {
|
|
|
|
var iscz = 0;
|
|
var Num1 = this.Num1;
|
|
var Num2 = this.Num2;
|
|
var Num3 = this.Num3;
|
|
var Num4 = this.Num4;
|
|
var Num5 = this.Num5;
|
|
var Num6 = this.Num6;
|
|
var Num7 = this.Num7;
|
|
var Num8 = this.Num8;
|
|
var Num9 = this.Num9;
|
|
var Num10 = this.Num10;
|
|
var Num11 = this.Num11;
|
|
var Num12 = this.Num12;
|
|
var Num13 = this.Num13;
|
|
var Num14 = this.Num14;
|
|
var Num15 = this.Num15;
|
|
$(SelectList).each(function () {
|
|
if (did == this.DetailId && storeid == this.StoreId) {
|
|
iscz = 1;
|
|
this.Num1 = Num1;
|
|
this.Num2 = Num2;
|
|
this.Num3 = Num3;
|
|
this.Num4 = Num4;
|
|
this.Num5 = Num5;
|
|
this.Num6 = Num6;
|
|
this.Num7 = Num7;
|
|
this.Num8 = Num8;
|
|
this.Num9 = Num9;
|
|
this.Num10 = Num10;
|
|
this.Num11 = Num11;
|
|
this.Num12= Num12;
|
|
this.Num13= Num13;
|
|
this.Num14 = Num14;
|
|
this.Num15 = Num15;
|
|
}
|
|
|
|
});
|
|
if (iscz == 0)
|
|
Array.add(SelectList, this);
|
|
|
|
}
|
|
else {
|
|
|
|
var did = this.DetailId;
|
|
|
|
$(SelectList).each(function () {
|
|
if (did == this.DetailId && storeid == this.StoreId)
|
|
Array.remove(SelectList, this);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
}
|
|
var SelectList =null;
|
|
//#endregion {Bind FirstImgUrl}
|
|
//#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='80px' height='80px'/></a>";
|
|
Array.add(datagrid1.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "仓库";
|
|
col.CellTemplate = "<a>{Bind StoreName}</a>";
|
|
Array.add(datagrid1.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "货物SKU";
|
|
col.Width = "180px";
|
|
col.Align = "left";
|
|
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind GoodsCode}【{Bind SKU}】</a><br/><span>{Bind GoodsName}</span>";
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "当前库存";
|
|
col.Width = "90px";
|
|
col.CellTemplate = "<span>{Bind KCNum}</span>";
|
|
//col.SortExpression = "b.GoodsNum";
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "剩余数量";
|
|
col.CellTemplate = "<span>{Bind LeftNum}</span>";
|
|
// col.SortExpression = "b.GoodsInNum";
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "我计划认购数";
|
|
// col.CellTemplate = "<span>{Bind BuyNum}</span>";
|
|
// Array.add(datagrid1.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "操作";
|
|
col.Width = "100px";
|
|
col.CellTemplate = "<span CommandName='cmdDel' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>删除</span>";
|
|
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() - 180;
|
|
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 CreateDataGrid3() {
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "缩略图";
|
|
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='80px' height='80px'/></a>";
|
|
Array.add(datagrid3.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "仓库";
|
|
col.CellTemplate = "<a>{Bind StoreName}</a>";
|
|
Array.add(datagrid3.Columns, col);
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "货物SKU";
|
|
col.Width = "150px";
|
|
col.Align = "left";
|
|
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind GoodsCode}【{Bind SKU}】</a><br/><span>{Bind GoodsName}</span>";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "当前库存";
|
|
col.Width = "60px";
|
|
col.CellTemplate = "<span>{Bind KCNum}</span>";
|
|
//col.SortExpression = "b.GoodsNum";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "剩余数量";
|
|
col.CellTemplate = "<span>{Bind LeftNum}</span>";
|
|
// col.SortExpression = "b.GoodsInNum";
|
|
Array.add(datagrid3.Columns, col);
|
|
$(slist).each(function (i) {
|
|
|
|
i = i + 1;
|
|
if (i < 16) {
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = this.ShopName + "认购数";
|
|
|
|
var row = "Num" + i.toString();
|
|
col.CellTemplate = "<input type='text' min='0' max='{Bind LeftNum}' precision='0' style='width:60px;' did='{Bind DetailId}' gcode='{Bind SKU}' sip='" + this.ShopId + "' storeid='{Bind StoreId}' sname='" + this.ShopName + "' class='editTextbox' ColName='" + row + "' value='{Bind " + row + "}' />";
|
|
col.Width = "60px";
|
|
Array.add(datagrid3.Columns, col);
|
|
}
|
|
|
|
});
|
|
|
|
|
|
// col = new nblf.ui.DataGridColumn();
|
|
// col.HeaderText = "我计划认购数";
|
|
// col.CellTemplate = "<span>{Bind BuyNum}</span>";
|
|
// Array.add(datagrid1.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "操作";
|
|
col.Width = "100px";
|
|
col.CellTemplate = "<span CommandName='cmdDel' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>删除</span>";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
datagrid3.SetPageSize(20);
|
|
datagrid3.SetPageIndex(1);
|
|
// datagrid1.SortExpression = "b.GoodsCode,b.Indate";
|
|
// datagrid1.ViewSortDirection = "ASC";
|
|
// datagrid1.IsFixHeader = true;
|
|
// datagrid1.Height = $(document).height() - 230;
|
|
datagrid3.ShowIndexColumn = false;
|
|
datagrid3.AllowPaging = false;
|
|
datagrid3.Width = "100%";
|
|
//datagrid1.Sorting(function () {
|
|
|
|
// ReadData();
|
|
//});
|
|
datagrid3.SelectMode = nblf.ui.SelectMode.None;
|
|
datagrid3.Init();
|
|
|
|
|
|
}
|
|
|
|
function AddTr() {
|
|
$("div[GNum]").each(function () {
|
|
var GNum = $(this).attr("GNum");
|
|
var SNum = $(this).attr("SNum");
|
|
if (GNum == "")
|
|
GNum = 0;
|
|
if (SNum == "")
|
|
SNum = 0;
|
|
if (parseInt(GNum) < parseInt(SNum)) {
|
|
$(this).css("background-color", "#ed5565");
|
|
|
|
}
|
|
});
|
|
//$("tr[name='DataGridRow']").each(function (i) {
|
|
|
|
|
|
|
|
// if (i % 2 == 0)
|
|
// $(this).css("background-color", "#EEEEEE");
|
|
// ;
|
|
|
|
//});
|
|
|
|
}
|
|
|
|
function GetExcelData() {
|
|
var param = new Object();
|
|
|
|
param.StoreId = $("#select_store2").val();
|
|
param.Type = 1; // $("#select_yj").val();
|
|
|
|
param.StoreName = $("#select_store2").find("option:selected").text();
|
|
|
|
param.GoodsName = $("#txt_Name2").val();
|
|
|
|
param.PageSize = 10000;
|
|
param.PageIndex = 1;
|
|
|
|
var fname = "认购表格导出.xls";
|
|
|
|
$.ajax({
|
|
url: "CK_Service.asmx/GetGoodsUserApplyExcel",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
async: false,
|
|
success: function (data) {
|
|
if (data.d == "0") {
|
|
|
|
alert("没找到你管理的店铺信息,不能认购");
|
|
return;
|
|
}
|
|
params = { FilePath: data.d, FileName: fname };
|
|
|
|
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
//#region 上传
|
|
function ajaxFileUpload() {
|
|
|
|
var filename = $("#fileToUpload").val();
|
|
if (IsExcel(filename) == false) { alert("请选择excel文件"); return; }
|
|
$.ajaxFileUpload({
|
|
url: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=ServerCookies',
|
|
secureuri: false,
|
|
fileElementId: 'fileToUpload',
|
|
dataType: 'json',
|
|
success: function (data, status) {
|
|
ImportGoods("ServerCookies/" + data.FileName);
|
|
},
|
|
error: function (data, status, e) {
|
|
alert(e);
|
|
}
|
|
});
|
|
}
|
|
//#region 读取数据
|
|
|
|
//#region
|
|
function ImportGoods(FileName) {
|
|
|
|
var param = new Object();
|
|
param.StoreId = $("#select_store2").val();
|
|
param.FileName = FileName;
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "CK_Service.asmx/ExcelBuyGoods",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
$("#tr1").hide();
|
|
$("#tr2").show();
|
|
datagrid3.DataBind(data.d);
|
|
$("input[max]").MaskedTextBox();
|
|
|
|
},
|
|
error: function (xhr, status) {
|
|
if (status != "success") alert(xhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
var StoreId = 0;
|
|
function ReadData() {
|
|
var param = new Object();
|
|
|
|
param.StoreId = $("#select_store2").val();
|
|
param.Type = 1; // $("#select_yj").val();
|
|
|
|
param.StoreName = $("#select_store2").find("option:selected").text();
|
|
|
|
param.GoodsName = $("#txt_Name2").val();
|
|
|
|
param.PageSize = datagrid1.Get_PageSize();
|
|
param.PageIndex = datagrid1.Get_PageIndex();
|
|
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "CK_Service.asmx/GetGoodsUserApply",
|
|
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.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 Id = 0;
|
|
function Save() {
|
|
if (datagrid1.DataSource == null || datagrid1.DataSource.length==0) {
|
|
alert("没有可以提交得数据");
|
|
return;
|
|
}
|
|
var md = new Object();
|
|
md.Id = Id;
|
|
md.Type = 1;
|
|
if ($("#rad_tx2").is(":checked") == true)
|
|
md.Type = 2;
|
|
var param = new Object();
|
|
param.model = md;
|
|
param.List = datagrid1.DataSource;
|
|
|
|
$.ajax({
|
|
url: "CK_Service.asmx/Save_UserBuyNum",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
dataType: "json",
|
|
success: function (data) {
|
|
|
|
alert(data.d);
|
|
|
|
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
function SaveList() {
|
|
if (datagrid3.DataSource == null || datagrid3.DataSource.length == 0) {
|
|
alert("没有可以提交得数据");
|
|
return;
|
|
}
|
|
var md = new Object();
|
|
md.Id = Id;
|
|
md.Type = 1;
|
|
if ($("#rad_tx2").is(":checked") == true)
|
|
md.Type = 2;
|
|
var param = new Object();
|
|
param.model = md;
|
|
var list = new Array();
|
|
$("#DataGrid3 input[did]").each(function () {
|
|
if ($(this).val() != "") {
|
|
var smd = new Object();
|
|
smd.DetailId = $(this).attr("did");
|
|
|
|
smd.StoreId = $(this).attr("storeid");
|
|
smd.BuyNum = $(this).val();
|
|
smd.ShopName = $(this).attr("sname");
|
|
smd.SKU = $(this).attr("gcode");
|
|
smd.ShopId = $(this).attr("sip");
|
|
Array.add(list, smd);
|
|
}
|
|
});
|
|
param.List = list;
|
|
if (list == null || list.length == 0) {
|
|
alert("没有填写认购数据");
|
|
return;
|
|
|
|
}
|
|
$.ajax({
|
|
url: "CK_Service.asmx/Save_UserBuyNumList",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
dataType: "json",
|
|
success: function (data) {
|
|
|
|
alert(data.d);
|
|
if (data.d == "提交成功")
|
|
window.location = "HW_GoodsAppplyList.aspx";
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//#endregion
|
|
</script>
|
|
</head>
|
|
<body class="headbody">
|
|
<div class="title_ico">
|
|
货物SKU认购</div>
|
|
<div style="display: none">
|
|
<div id="test" title="货物图片" style="width: 1200px; height: 810px;">
|
|
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
|
|
<tr>
|
|
<td class="f1" width="15%">
|
|
仓库:
|
|
</td>
|
|
<td>
|
|
<select id="select_store" class="selectClass" style="width: 95px" name="D1">
|
|
</select>
|
|
</td>
|
|
<td class="f1" width="15%">
|
|
编号:
|
|
</td>
|
|
<td>
|
|
<input id="txt_Name" class="editTextbox" style="width: 120px;" type="text" />
|
|
<input id="btn_Sch1" type="button" class="btnClass btnClassFind" value="查询" /> <input id="Button3" type="button" class="btnClass btnClassSave" value="保存" onclick="AddGoods();" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="4">
|
|
<div id="DataGrid2" class="DataGridStyle" style="overflow: auto; height: 720px; width: 1100px;">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" colspan="4">
|
|
<input id="Button5" type="button" class="btnClass btnClassSave" value="确 定" onclick="AddGoods();" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<table id="tb1" class="tableAll" style="width: 100%;">
|
|
<tr style="display: none">
|
|
<td align="left" colspan="5">
|
|
<input id="rad_tx1" type="radio" name="hw" checked="checked" />从库存中挑选货物<input id="rad_tx2"
|
|
type="radio" name="hw" />从海外出运中挑选货物(海外出运认购只能用于参考,实际入库时候还需要重新认购)
|
|
</td>
|
|
</tr>
|
|
<tr style="display: none">
|
|
<td class="f1" width="15%">
|
|
仓库:
|
|
</td>
|
|
<td>
|
|
<select id="select_store2" class="selectClass" style="width: 95px" name="D1">
|
|
</select>
|
|
</td>
|
|
<td class="f1" width="15%">
|
|
编号:
|
|
</td>
|
|
<td>
|
|
<input id="txt_Name2" class="editTextbox" style="width: 120px;" type="text" />
|
|
</td>
|
|
<td>
|
|
<input id="btn_Sch" type="button" class="btnClass btnClassFind" value="查询" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" colspan="5">
|
|
<input id="btn_Add" class="btnClass btnClassAdd" type="button" value="挑选货物" />
|
|
<div style="display: none">
|
|
<input id="Button2" class="btnClass btnClassExcelTemplate" type="button" value="导出认购表格Excel"
|
|
onclick="GetExcelData();" />
|
|
<input id="fileToUpload" accept="excel/xls" name="fileToUpload" type="file" style="width: 200px" />
|
|
<input class="btnClass btnClassImportExcel" type="button" value="认购导入" id="btn_import" /><font
|
|
color="red">注:先下载货物库存表格填写好认购数量再导入</font> (导出的剩余数量只是当前导出的剩余数量,导入时候有可能剩余已经变动了,导入数量大于剩余时候提交时候会提醒不能提交)</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="tr1" style="display: none">
|
|
<td valign="top" colspan="5">
|
|
<div id="DataGrid1" class="DataGridStyle">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="tr2">
|
|
<td align="center" colspan="5">
|
|
<div id="DataGrid3" class="DataGridStyle">
|
|
</div>
|
|
<br />
|
|
<input id="Button1" class="btnClass btnClassSave" type="button" value="提交" onclick="SaveList();" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
</html>
|