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.

468 lines
18 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="CG_ChaseInHouse.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseInHouse" %>
<!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/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
$(document).keyup(function (event) {
if (event.keyCode == 13) {
ReadData();
}
});
ReadData();
$("#" + datagrid1.TableID + " [CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
// window.location.href = "CG_ChaseLook.aspx?ChaseId=" + model.ChaseId;
window.parent.addTab("采购单", "CaiGou/CG_ChaseLook.aspx?Check=Edit&Title=采购入库&ChaseId=" + model.ChaseId, true);
});
$("#cmdAdd").bind("click", function () {
var SelectListModels = datagrid1.GetSelectListModel();
if (SelectListModels == null || $(SelectListModels).length == 0) {
alert("请选择要开启或者关闭的评价");
return;
}
});
$("#select_hwstate,#select_state").live("change", function () {
ReadData();
});
$("#btn_sch,#chk_mx").bind("click", function () {
ReadData();
});
$("#btn_sch2").bind("click", function () {
if ($("#txt_kddh").val() == "")
{
alert("请输入快递单号");
return;
}
ReadData();
});
$("#a_gj").bind("click", function () {
if ($("#tr1").css("display") == "none")
{
$("#tr1").show();
$("#tr2").show();
$("#tr3").show();
}
else
{
$("#tr1").hide();
$("#tr2").hide();
$("#tr3").hide();
}
});
});
function AddTr() {
$("#" + datagrid1.TableID + " tr").each(function (i) {
if (i > 0) {
var shtmls = "<tr><td colspan='11'>";
var index = $(this).attr("index");
var md = datagrid1.Get_Model(index);
if (md.GoodsList != null) {
$(md.GoodsList).each(function () {
shtmls += "<table width='100%'><tr><td width='50px'></td><td><font color='blue'>购买商品:</font><span>" + this.GoodsName + " &nbsp; &nbsp;<font color='blue'>商品SKU</font>" + this.SKU1 +"["+ this.TypeDesc + "]</span> &nbsp; &nbsp;<font color='blue'>购买数量:</font><span>" + this.GoodsNum + "</span> &nbsp; &nbsp;<font color='blue'>到货数量:</font>" + this.InGoodsNum + "</td></tr></table>";
});
}
shtmls += "</td><tr>";
$(this).after(shtmls);
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购单号";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind ChaseCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买订单号";
col.CellTemplate = "<a>{Bind BuyCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购日期";
col.CreateFieldSpan("BuyDate", "yyyy-MM-dd");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "预计到货日期";
col.CreateFieldSpan("DoneDate", "yyyy-MM-dd");
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.CellTemplate = "<span>{Bind GoodsMoney}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购人";
col.CellTemplate = "<span>{Bind InName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "审批状态";
col.CellTemplate = "<a>{Bind CheckState}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "收货状态";
col.CellTemplate = "<a no='revice'>{Bind ReveState}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "异常备注";
col.Align = "left";
col.Width = "150px";
col.CellTemplate = "<a title='{Bind ErrorInfo}'>{Bind SimpErrorInfo}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "180px";
col.CellTemplate = "<input onclick='EditCol(this)' CommandName='cmdEdit' no='{Bind State}' gno='{Bind GoodsState}' class='btnClass dgbtnEdit' type='button' value='入库'></input> &nbsp;<input onclick='InCol(this)' CommandName='cmdZJRK' no='{Bind State}' class='btnClass dgbtnEdit' type='button' gno='{Bind GoodsState}' value='直接入库'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(30);
datagrid1.SetPageIndex(1);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
function InCol(obj) {
if (window.confirm('直接入库表示货物全部到齐且没有异常,确定要直接入库吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.ChaseId = model.ChaseId;
$.ajax({
url: "CaiGouService.asmx/ChaseInStoreNew",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d == 1)
{
alert("该采购单已经由入库记录,不能直接入库,可以点击入库");
}
else
alert("入库成功");
ReadData();
}
});
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.PostCode = $("#txt_kddh").val();
param.ChaseCode = $("#txt_cgdh").val();
param.BuyCode = $("#txt_gmdh").val();
param.Goods = $("#txt_cgwp").val();
param.Name = $("#txt_cgr").val();
param.SDate = null;
if ($("#txt_SDate").val() != "")
param.SDate = $("#txt_SDate").val();
param.State = $("#select_state").val();
param.DHState = $("#select_hwstate").val();
param.EDate = null;
if ($("#txt_EDate").val() != "")
param.EDate = $("#txt_EDate").val();
// if ($("#txt_Edate").val() != "")
//param.Edate = null;
param.SRKDate = null;
if ($("#txt_SRKDate").val() != "")
param.SRKDate = $("#txt_SRKDate").val();
param.ERKDate = null;
if ($("#txt_ERKDate").val() != "")
param.ERKDate = $("#txt_ERKDate").val();
param.IsDetail = 0;
if ($("#chk_mx").is(':checked') == true)
param.IsDetail = 1;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetListCG_Inchase",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
if (param.IsDetail == 1)
AddTr();
$("a[no='revice']").each(function () {
if ($(this).html() != "已收货") {
$(this).css("color", "Red");
}
});
$("#" + datagrid1.TableID + " input[CommandName='cmdEdit']").each(function () {
if ($(this).attr("gno") ==2||$(this).attr("no") == 3) {
$(this).val("查看");
}
});
$("#" + datagrid1.TableID + " input[CommandName='cmdZJRK']").each(function () {
if ($(this).attr("gno") > 0) {
$(this).hide();
}
if ($(this).attr("no") > 1) {
$(this).hide();
}
else
if ($(this).attr("gno") == 2) {
$(this).val("结束采购单");
}
});
}
});
}
function EditCol(obj) {
var rowindex = $(obj).parent().parent().attr("index");
var model = datagrid1.Get_Model(rowindex);
var ChaseId = model.ChaseId;
if ($(obj).val() == "查看")
window.parent.addTab("采购单", "CaiGou/CG_ChaseLook.aspx?IsCheck=Edit&Title=采购入库&ChaseId=" + model.ChaseId, true);
//window.location.href = "CG_ChaseLook.aspx?ChaseId=" + model.ChaseId;
else
window.parent.addTab("采购单入库", "CaiGou/CG_ChaseInHouseAdd.aspx?Title=采购入库&ChaseId=" + model.ChaseId, true);
// window.location = "CG_ChaseInHouseAdd.aspx?ChaseId=" + ChaseId;
}
//#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);
if (model.State > 0) {
alert("该采购单已经审批,不能删除");
return;
}
param.ChaseId = model.ChaseId;
$.ajax({
url: "CaiGouService.asmx/DeletePurchase",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<form id="form1" runat="server">
<div class="title_ico">
采购入库
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="f1" width="13%">快递单号:</td>
<td width="200px">
<input id="txt_kddh" class="editTextbox" style="width: 120px;" type="text" /></td>
<td colspan="5">
<input id="btn_sch2" class="btnClass btnClassFind" type="button" value="确定" />&nbsp; <input id="chk_mx" type="checkbox" /><label for="chk_mx">列出采购货物明细</label><a id="a_gj" style="color:blue;text-decoration:underline;cursor:pointer"><img src="../images/icon03.jpg"/>高级搜索</a></td>
</tr>
<tr id="tr1">
<td class="f1" width="13%">采购单号:</td>
<td width="15%">
<input id="txt_cgdh" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" width="13%">购买单号:</td>
<td width="15%">
<input id="txt_gmdh" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%;">采购物品:</td>
<td width="15%"><input id="txt_cgwp" class="editTextbox" style="width: 120px;" type="text" />
</td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr id="tr2">
<td class="f1" width="13%">到货状态:</td>
<td> <select id="select_hwstate" class="selectClass" style="width: 150px" name="D2">
<option value="-1">全部</option>
<option value="4" selected="selected">未到货或部分到货</option>
<option value="0">未到货</option>
<option value="1">部分到货</option>
<option value="2">已到货</option>
<option value="3">到货异常</option>
</select>
</td>
<td class="f1" style="width: 10%; height: 15px;">订单状态:</td>
<td>
<select id="select_state" class="selectClass" style="width: 120px" name="D1">
<option value="0">全部</option>
<option value="2">未结束</option>
<option value="3">已结束</option>
</select></td>
<td class="f1">采购人:</td>
<td>
<input id="txt_cgr" class="editTextbox" style="width: 120px;" type="text" /></td>
<td></td>
</tr>
<tr id="tr3">
<td class="f1" width="13%">采购日期:</td>
<td colspan="3">
<input id="txt_SDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" />-
<input id="txt_EDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" /></td>
<td class="f1" width="13%">入库日期:</td>
<td colspan="2">
<input id="txt_SRKDate" class="editTextbox" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" style="width: 130px;" type="text" />-
<input id="txt_ERKDate" class="editTextbox" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" style="width: 130px;" type="text" /></td>
</tr>
<tr>
<td colspan="7">
<font color="color">注:直接入库表示采购单货物全部到齐且都没有问题,货物入库到默认仓库且不对应库位<br />
有到货异常或者要选库位入库的请点击入库按钮,不要用直接入库
</font></td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</form>
</body>
</html>