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.
ERP/TradeManage/HuoWu/HW_GoodsOutAddForTM.aspx

671 lines
24 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_GoodsOutAddForTM.aspx.cs" Inherits="TradeManage.HuoWu.HW_GoodsOutAddForTM" %>
<!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/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/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_GoodsOutListForTM.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();
$(slist).each(function () {
var did = this.DetailId;
var flag = false;
var sid = this.StoreId;
var pid = this.PostionId;
$(CKOutlist).each(function () {
var rdid = this.DetailId;
var rsid = this.DetailId;
var rpid = this.DetailId;
if (did == rdid && sid == rsid && pid == rpid) {
flag = true;
}
});
if (flag == false) {
Array.add(CKOutlist, this);
}
});
datagrid1.DataBind(CKOutlist);
$("input[precision]").MaskedTextBox();
$.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/GetGoodsOutDetailForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d == null)
{
alert("没有该货物或者货物库存都被订单占用,无法出库");
}
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 = "<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.CellTemplate = "<span>{Bind StoreName}【{Bind PostionDesc}】</span>";
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='{Bind GoodsNum}' precision='0' style='width:50px;' class='editTextbox' ColName='OutNum' value='{Bind OutNum}'/>";
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>";
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 = "<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;
}
$("#cmdSave").attr("disabled", "disabled");
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);
// }
//});
datagrid1.UpdateDataSource();
param.CKList = datagrid1.DataSource;
$.ajax({
url: "HuoWuService.asmx/SaveGoodsOutForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
alert(data.d);
$("#cmdSave").removeAttr("disabled");
if (data.d == "提交成功")
window.location.href = "HW_GoodsOutListForTM.aspx";
}
});
}
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="出库货物" style="width:750px; 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">
&nbsp;</td>
<td>
&nbsp;</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>