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.

650 lines
23 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_GoodsOutAdd.aspx.cs" Inherits="TradeManage.HuoWu.HW_GoodsOutAdd" %>
<!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 OutId = 0;
var GoodsId = 0;
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
OutId = $.url.param("OutId");
if (OutId == undefined) {
OutId = 0;
}
if (OutId == 0)
GetOutCode();
GetCKYY();
$("#txtInName").val(name);
CreateDataGrid();
CreateDataGrid2();
$("#btn_add").bind("click", function () {
fopen();
});
$("#btn_Save").bind("click", function () {
AddCKOut();
});
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdBack").bind("click", function () {
window.location.href = "HW_GoodsOutList.aspx";
});
// ReadGoods();
});
function GetCKYY() {
$("#txtOutReason").append("<option value='0'>-选择-</option>");
var param = new Object();
param.CompanyID = 0;
param.KeyName = "ckyy";
$.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 () {
$("#txtOutReason").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 GetOutCode() {
$.ajax({
url: "HuoWuService.asmx/GetOutCode",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#txtOutCode").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 CKOutlist = new Array();
function AddCKOut()
{
var slist=datagrid2.GetSelectListModel();
if (slist == null || slist.length == 0)
{
alert("请选择要出库的物品");
return;
}
datagrid1.UpdateDataSource();
var error = "";
$(slist).each(function () {
var did = this.DetailId;
var flag = false;
// var outnum = parseInt(this.GoodsNum) - parseInt(this.GoodsLockNum);
// if (outnum <= 0)
// error += this.SKU1 + "没有库存或者库存都已经被订单锁定,不能出库;";
//$(CKOutlist).each(function () {
// var rdid = this.DetailId;
// if (did == rdid) {
// flag = true;
// }
//});
//if (outnum>0 && flag == false) {
GetGoodsOutCK(did, this);
// }
});
if (error != "") {
alert(error);
return;
}
$.fancybox.close();
}
function GetGoodsOutCK(DetailId,obj) {
var param = new Object();
param.DetailId = DetailId;
$.ajax({
url: "HuoWuService.asmx/GetGoodsOutCK",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
obj.GoodsOutCKList=data.d;
Array.add(CKOutlist, obj);
BindDg1();
}
});
}
function GetCkHtml()
{
$(CKOutlist).each(function () {
if (this.GoodsOutCKList != null && this.GoodsOutCKList.length > 0) {
var shtml = "<table width='95%'>";
$(this.GoodsOutCKList).each(function () {
var store = this.StoreName;
if (this.PostionDesc!= null)
store = this.StoreName + " " + this.PostionDesc;
shtml += "<tr><td>" + store + " 允许出库数:" + this.GoodsNum + " 出库:<input type='text' min='0' max='" + this.GoodsNum + "' precision='0' style='width:50px;' class='editTextbox' did='" + this.DetailId + "' sid='" + this.StoreId + "' pid='" + this.PostionId + "' value='" + this.OutNum + "'/></td></tr>";
});
shtml += "</table>";
$("div[did='" + this.DetailId + "']").html(shtml);
}
});
//<table width='95%'><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr></table>
}
function BindDg1()
{
datagrid1.DataBind(CKOutlist);
GetCkHtml();
$("input[precision]").MaskedTextBox();
}
function ReadGoodsDetail() {
var param = new Object();
param.GoodsCode = $("#txt_hwbhmc").val();
WindowLoadModel.Show();
$.ajax({
url: "HuoWuService.asmx/GetGoodsOutDetailNew",
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("");
}
});
}
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号";
col.CellTemplate = "<a>{Bind GoodsCode}</a>";
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 = "<a>{Bind TypeCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<a>{Bind SKU1}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "描述";
col.CreateFieldSpan("TypeDesc", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "出库数量";
// col.Width = "100px";
col.CellTemplate = "<div did='{Bind DetailId}'></div>";
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;
datagrid1.UpdateDataSource();
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.Id = model.Id;
//if (model.Id > 0) {
// $.ajax({
// url: "CaiGouService.asmx/DeletePurchaseGoods",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
// dataType: "json",
// success: function (data) {
// }
// });
//}
alert("删除成功");
datagrid1.Del_Row(rowindex);
// heji();
//hesl();
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<span>{Bind GoodsName}<span>";
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><span>{Bind StoreName}【{Bind PostionDesc}】<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 DelPost(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid3.Get_Model(rowindex);
param.Id = model.Id;
if (model.Id > 0) {
$.ajax({
url: "CaiGouService.asmx/DeletechasePost",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
}
});
}
alert("删除成功");
datagrid3.Del_Row(rowindex);
}
function heji() {
var je = 0;
$("input[ColName='BuyMoney']").each(function () {
if ($(this).val() != "") {
je += parseFloat($(this).val());
}
});
$("#a_hjje").html(je.toFixed(2));
}
function hesl() {
var sl = 0;
$("input[ColName='BuyNum']").each(function () {
if ($(this).val() != "") {
sl += parseInt($(this).val());
}
});
$("#a_hjsl").html(sl);
}
function save() {
if ($("#txtInDate").val() == "") {
alert("请填写出库日期");
return;
}
if ($("#txtOutReason").val() == "0") {
alert("请填写出库原因");
return;
}
var List = new Array();
var param = new Object();
var model = new Object();
model.OutCode = $("#txtOutCode").html();
model.OutReason = $("#txtOutReason").val();
model.Remark = $("#txtRemark").val();
model.InName = $("#txtInName").val();
param.model = model;
$("input[did]").each(function () {
if($(this).val()!="")
{
var md=new Object();
md.StoreId = $(this).attr("sid");
md.PostionId = $(this).attr("pid");
md.DetailId = $(this).attr("did");
md.OutNum = $(this).val();
Array.add(List, md);
}
});
param.CKList = List;
$.ajax({
url: "HuoWuService.asmx/SaveGoodsOut",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
alert("提交成功");
window.location.href = "HW_GoodsOutList.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="txtOutCode"></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">
出库原因:</td>
<td>
<select id="txtOutReason" 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>