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.

703 lines
26 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsInAddForTM.aspx.cs" Inherits="TradeManage.HuoWu.HW_GoodsInAddForTM" %>
<!DOCTYPE html>
<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/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/MaskedTextBox.js" type="text/javascript"></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_GoodsInListForTM.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 () {
if (this.Name == "库存调整")
{
$("#txtInReason").append("<option value='" + this.Name + "' selected='selected'>" + this.Name + "</option>");
}
else
$("#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()
{
datagrid2.UpdateDataSource();
datagrid1.UpdateDataSource();
//$(RKInlist).each(function () {
// this.StoreId = $("select[ckid='" + this.DetailId + "']").val();
// this.PostionId = $("select[kwid='" + this.DetailId + "']").val();
//});
$("#DataGrid2 input[ColName='InNum']").each(function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid2.Get_Model(RowIndex);
if (model.InNum > 0) {
var did = model.DetailId;
var flag = false;
$(RKInlist).each(function () {
var rdid = this.DetailId;
if (did == rdid) {
flag = true;
}
});
if (flag == false) {
Array.add(RKInlist, model);
}
}
});
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/GetGoodsInDetailForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid2.DataBind(data.d);
$("input[precision]").MaskedTextBox();
}
});
}
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 = "货物编号新";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号";
col.CellTemplate = "<span>{Bind GoodsOldCode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "型号";
col.CellTemplate = "<span>{Bind TypeCode}</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.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 = "<input type='text' style='width:80px;' class='editTextbox' ColName='PostionCode' value='{Bind PostionCode}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库数量";
col.CellTemplate = "<input type='text' min='0' max='1000000' 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 DelGoods(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var model = datagrid1.Get_Model(rowindex);
if (RKInlist != null)
{
$(RKInlist).each(function () {
var rdid = this.DetailId;
if (model.DetailId == rdid)
Array.remove(RKInlist, this);
});
}
datagrid1.Del_Row(rowindex);
}
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 = "货物编号";
col.CellTemplate = "<span>{Bind GoodsOldCode}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物新编号";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "型号";
col.CellTemplate = "<span>{Bind TypeCode}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "描述";
col.CellTemplate = "<span>{Bind TypeDesc}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库数量";
col.CellTemplate = "<input type='text' min='1' max='1000000' precision='0' style='width:50px;' class='editTextbox' ColName='InNum' value='{Bind InNum}'/>";
Array.add(datagrid2.Columns, col);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid2.SelectMode = nblf.ui.SelectMode.None;
datagrid2.Init();
}
function save() {
//if ($("#txtInDate").val() == "") {
// alert("请填写入库日期");
// return;
//}
if ($("#txtInReason").val() == "0") {
alert("请填写入库原因");
return;
}
$("#cmdSave").attr("disabled", "disabled");
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();
var list = datagrid1.DataSource;
var Error = "";
var pcode = $("#txtKW").val();
$(list).each(function () {
if (pcode == "" && this.PostionCode == "")
Error += this.GoodsOldCode + ' ' + this.TypeCode + '入库库位没填,';
else if (pcode != "" && this.PostionCode == "")
this.PostionCode = pcode;
//if (this.InNum == null || this.InNum == 0)
// Error += this.GoodsOldCode + ' ' + this.TypeCode + '入库数量没填,';
});
if (Error != "")
{
alert(Error);
return;
}
//$(RKInlist).each(function () {
// this.StoreId = $("select[ckid='" + this.DetailId + "']").val();
// this.PostionId = $("select[kwid='" + this.DetailId + "']").val();
//});
param.RKList = list;
$.ajax({
url: "HuoWuService.asmx/SaveGoodsInForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d == "") {
alert("提交成功");
$("#cmdSave").removeAttr("disabled");
window.location.href = "HW_GoodsInListForTM.aspx";
}
else
alert(data.d);
$("#cmdSave").removeAttr("disabled");
}
});
}
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="出库货物" style="width:700px; 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">
&nbsp;</td>
<td>
&nbsp;</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;库位:<input id="txtKW" type="text" style="width:100px;" class="editTextbox"/><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>