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.

656 lines
23 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsInAdd.aspx.cs" Inherits="TradeManage.HuoWu.HW_GoodsInAdd" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title>出库单</title>
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<link rel="stylesheet" type="text/css" href="../themes/uploadify.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 type="text/javascript" src="../Scripts/uploadify/jquery.uploadify.js"></script>
<script src="../Scripts/ajaxfileupload.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>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<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/Global.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
var name = "<%=Session["Name"]%>";
var InId = 0;
var GoodsId = 0;
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
InId = $.url.param("InId");
if (InId == undefined) {
InId = 0;
}
GetStore();
if (InId == 0)
GetInCode();
GetRKYY();
$("#txtInName").val(name);
CreateDataGrid();
CreateDataGrid2();
$("#btn_add").bind("click", function () {
fopen();
});
$("#btn_Save").bind("click", function () {
AddRKIn();
});
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdBack").bind("click", function () {
window.location.href = "HW_GoodsOutList.aspx";
});
// ReadGoods();
});
function GetRKYY() {
$("#txtInReason").append("<option value='0'>-选择-</option>");
var param = new Object();
param.CompanyID = 0;
param.KeyName = "rkyy";
$.ajax({
url: "../UserService.asmx/GetListBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
$("#txtInReason").append("<option value='" + this.Name + "'>" + this.Name + "</option>");
});
}
}
});
}
function GetChaseModel() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetPurchaseModel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
$("#a_cgdh").html(data.d.ChaseCode);
$("#txtBuyCode").val(data.d.BuyCode);
$("#txt_yfhj").val(data.d.PostFee);
$("#txt_bzxx").val(data.d.Remark);
if (data.d.BuyDate!=null)
$("#txt_cgrq").val(data.d.BuyDate.localeFormat("yyyy-MM-dd"));
if (data.d.DoneDate != null)
$("#txt_yjdhrq").val(data.d.DoneDate.localeFormat("yyyy-MM-dd"));
$("#txt_gys").val(data.d.Supplier);
$("#txt_lxfs").val(data.d.SupplierPhone);
$("#txtInName").val(data.d.InName);
$("#txt_gmzh").val(data.d.Account);
$("#a_hjsl").html(data.d.GoodsNum);
$("#a_hjje").html(data.d.GoodsMoney);
}
}
});
}
function GetInCode() {
$.ajax({
url: "HuoWuService.asmx/GetOutCode",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#txtInCode").html(data.d)
}
}
});
}
var GoodsList=null;
function ReadGoods() {
// var param = new Object();
$.ajax({
url: "CaiGouService.asmx/GetSNGoods",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
GoodsList = data.d;
$(data.d).each(function () {
$("#select_hwlx").append("<option value=" + this.GoodsId + ">" + this.GoodsCode +"["+this.GoodsName+"]</option>");
});
}
}
});
}
function AddGoods() {
if ($("#txt_hwbhmc").val() == "")
{
alert("请输入要查询的条件");
return;
}
ReadGoodsDetail();
}
var RKInlist = new Array();
function AddRKIn()
{
var slist=datagrid2.GetSelectListModel();
if (slist == null || slist.length == 0)
{
alert("请选择要出库的物品");
return;
}
datagrid1.UpdateDataSource();
$(RKInlist).each(function () {
this.StoreId = $("select[ckid='" + this.DetailId + "']").val();
this.PostionId = $("select[kwid='" + this.DetailId + "']").val();
});
$(slist).each(function () {
var did = this.DetailId;
var flag = false;
$(RKInlist).each(function () {
var rdid = this.DetailId;
if (did == rdid) {
flag = true;
}
});
if (flag == false) {
Array.add(RKInlist, this);
}
});
datagrid1.DataBind(RKInlist);
GetRKHtml();
$("input[precision]").MaskedTextBox();
$.fancybox.close();
}
function GetRKHtml()
{
$(RKInlist).each(function () {
var did = this.DetailId
if (this.StoreId == null || this.StoreId == StoreNo) {
$(StoreList).each(function () {
$("select[ckid='" + did + "']").append("<option value='" + this.StoreId + "'>" + this.StoreName + "</option>");
});
var pid = this.PostionId;
$("select[kwid='" + did + "']").append("<option value='0'>无</option>");
$(PostionList).each(function () {
if (this.PostionId == pid)
$("select[kwid='" + did + "']").append("<option value='" + this.PostionId + "' selected='selected'>" + this.PostionDesc + "</option>");
else
$("select[kwid='" + did + "']").append("<option value='" + this.PostionId + "'>" + this.PostionDesc + "</option>");
});
}
else
if (this.StoreId != StoreNo) {
GetPostion2(this.StoreId);
var sid=this.StoreId;
$(StoreList).each(function () {
if (this.StoreId == sid)
$("select[ckid='" + did + "']").append("<option value='" + this.StoreId + "' selected='selected'>" + this.StoreName + "</option>");
else
$("select[ckid='" + did + "']").append("<option value='" + this.PostionId + "'>" + this.PostionDesc + "</option>");
});
var pid = this.PostionId;
$("select[kwid='" + did + "']").append("<option value='0'>无</option>");
$(PostionList1).each(function () {
if (this.PostionId == pid)
$("select[kwid='" + did + "']").append("<option value='" + this.PostionId + "' selected='selected'>" + this.PostionDesc + "</option>");
else
$("select[kwid='" + did + "']").append("<option value='" + this.PostionId + "'>" + this.PostionDesc + "</option>");
});
}
});
}
function ReadGoodsDetail() {
var param = new Object();
param.GoodsCode = $("#txt_hwbhmc").val();
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetGoodsInDetailNew",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
datagrid2.DataBind(data.d);
}
});
}
var Urllist = new Array();
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
$("#txt_hwbhmc").val("");
}
});
}
var StoreList = new Array();
var StoreNo = 0;
function GetStore() {
$.ajax({
url: "../CangKu/CangKuServer.asmx/GetUseStoreHouse",
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
StoreList = data.d;
if (data.d!=null&&data.d.length>0)
GetPostion(data.d[0].StoreId);
}
}
});
}
var PostionList = new Array();
function GetPostion(SId) {
StoreNo = SId;
var param = new Object();
param.StoreId = SId;
if (param.StoreId > 0) {
$.ajax({
url: "../CangKu/CangKuServer.asmx/GetStorePostion",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
PostionList = data.d;
}
});
}
}
var PostionList2 = new Array();
function GetPostion2(SId) {
var param = new Object();
param.StoreId = SId;
if (param.StoreId > 0) {
$.ajax({
url: "../CangKu/CangKuServer.asmx/GetStorePostion",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
PostionList2 = data.d;
}
});
}
}
//#region 初始化DataGrid
function CreateDataGrid() {
var 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 = "SKU";
col.CellTemplate = "<span>{Bind SKU1}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "价格";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='1000000' precision='2' style='width:50px;' class='editTextbox' ColName='Price' value='{Bind Price}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "运费成本(单件)";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='10000' precision='2' style='width:50px;' class='editTextbox' ColName='PostPrice' value='{Bind PostPrice}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库仓库";
col.CellTemplate = "<select class='selectClass' ckid='{Bind DetailId}'></select>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库库位";
col.CellTemplate = "<select class='selectClass' kwid='{Bind DetailId}'></select>";
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.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='10000' precision='0' style='width:50px;' class='editTextbox' ColName='InNum' value='{Bind InNum}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "150px";
col.CellTemplate = "<input onclick='DelGoods(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<span>{Bind GoodsName}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<span>{Bind SKU1}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "最近批次价格";
col.CellTemplate = "<span>{Bind Price}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "最近批次运费成本";
col.CellTemplate = "<span>{Bind PostPrice}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "库存数量";
col.CellTemplate = "<span>{Bind GoodsNum}</span>";
Array.add(datagrid2.Columns, col);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid2.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid2.Init();
}
function save() {
if ($("#txtInDate").val() == "") {
alert("请填写入库日期");
return;
}
if ($("#txtInReason").val() == "0") {
alert("请填写入库原因");
return;
}
var List = new Array();
var param = new Object();
var model = new Object();
model.InCode = $("#txtInCode").html();
model.InReason = $("#txtInReason").val();
model.Remark = $("#txtRemark").val();
model.InName = $("#txtInName").val();
param.model = model;
datagrid1.UpdateDataSource();
$(RKInlist).each(function () {
this.StoreId = $("select[ckid='" + this.DetailId + "']").val();
this.PostionId = $("select[kwid='" + this.DetailId + "']").val();
});
param.RKList = datagrid1.DataSource;
$.ajax({
url: "HuoWuService.asmx/SaveGoodsIn",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
alert("提交成功");
window.location.href = "HW_GoodsInList.aspx";
}
});
}
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="出库货物" style="width:680px; height:370px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 110px;" class="f1">
货物编号/名称/SKU
</td>
<td align="left" colspan="3">
<input id="txt_hwbhmc" class="editTextbox" style="width:120px;" type="text" />
</td>
<td><input id="Button1" type="button" value="查询" class="btnClass btnClassFind" onclick="AddGoods();"/></td>
</tr>
<tr>
<td align="left" colspan="5">
<div id="DataGrid2" style="height:300px;overflow:auto"></div>
</td>
</tr>
<tr>
<td align="center" colspan="5">
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="添 加" />&nbsp;&nbsp;&nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
入库单</div>
<table border="1" cellpadding="0" cellspacing="0" style="width:99%;" align="center" class="tableAll">
<tr>
<td colspan="4" align="center" style="font-size:18pt;font-weight:bolder">
入库单</td>
</tr>
<tr>
<td style="width:120px" class="f1">
<font color="red" style="font-weight:bolder">*</font>
入库单号:
</td>
<td>
<a id="txtInCode"></a>
</td> <td style="width:120px" class="f1">
<font color="red" style="font-weight:bolder">*</font>
入库日期:
</td>
<td>
<input id="txtInDate" class="editTextbox" onfocus="WdatePicker()" style="width:200px;" type="text" />
</td>
</tr>
<tr>
<td style="width:120px" class="f1">
<font color="red" style="font-weight:bolder">*</font>入库原因:</td>
<td>
<select id="txtInReason" class="selectClass" style="width:200px;"></select></td> <td style="width:120px" class="f1">
入库人:
</td>
<td> <input id="txtInName" type="text" style="width:200px;" class="editTextbox"/>
</td>
</tr>
<tr>
<td style="width:120px" class="f1">
备注信息:</td>
<td colspan="3">
<textarea id="txtRemark" cols="100" rows="4" style="width:90%"></textarea>
</td>
</tr>
<tr>
<td style="width:120px" class="f1">
出库货物:</td>
<td colspan="3"> <a id="btn_add"
style="cursor: pointer; text-decoration: underline; color: blue;">
<img alt="" src="../images/add.ico" />选择入库货物</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<div id="DataGrid1" class="DataGridStyle"></div></td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" type="button" value="提 交" class="btnClass btnClassSave" onclick="save();" />
<input id="cmdBack" type="button" value="返 回" class="btnClass btnClassBack" />&nbsp;
</td>
</tr>
</table>
</body>
</html>