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/CaiGou/CG_ChaseInHouseForTM2.aspx

687 lines
28 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseInHouseForTM2.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseInHouseForTM2" %>
<!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();
var DHState = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
ReadBuyUser();
CreateDataGrid();
$(document).keyup(function (event) {
if ($("#txt_kddh").is(":focus") == true && 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;
//if(model.State==3)
//window.parent.addTab("采购单", "CaiGou/CG_ChaseLookForTM.aspx?Check=Edit&Title=采购入库&ChaseId=" + model.ChaseId, true);
//else
var kw = "0";
if ($("#txt_kwcode").val() != "")
kw = $("#txt_kwcode").val();
window.parent.addTab("采购单入库", "CaiGou/CG_ChaseInHouseAdd.aspx?Title=采购入库&ChaseId=" + model.ChaseId + "&KW=" + kw, true);
});
//$("#" + datagrid1.TableID + " a[cid]").live("click", function () {
//});
$("#cmdAdd").bind("click", function () {
var SelectListModels = datagrid1.GetSelectListModel();
if (SelectListModels == null || $(SelectListModels).length == 0) {
alert("请选择要开启或者关闭的评价");
return;
}
});
$("#select_state").live("change", function () {
ReadData();
});
$("#btn_sch,#chk_mx,#chk_gc,#chk_bh,#chk_wr,#chk_dhyc").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();
}
});
GetPostion();
$("#btn_tj1").bind("click", function () {
Clearcss();
DHState = 0;
$(this).attr("class", "btnSelected");
ReadData();
});
//$("#btn_tj2").bind("click", function () {
// DHState =1;
// Clearcss();
// $(this).attr("class", "btnSelected");
// ReadData();
//});
$("#btn_tj3").bind("click", function () {
Clearcss();
DHState = 3;
$(this).attr("class", "btnSelected");
ReadData();
});
$("#btn_tj4").bind("click", function () {
Clearcss();
DHState = 4;
$(this).attr("class", "btnSelected");
ReadData();
});
$("#chk_image").bind("click", function () {
ReadData();
});
$("#" + datagrid1.TableID + " [CommandName='cmdBuy']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
if (model.Account != null && model.Account.indexOf("阿里巴巴") >= 0) {
window.open("http://trade.1688.com/order/unify_buyer_detail.htm?orderId=" + model.BuyCode);
}
else {
window.open("http://trade.taobao.com/trade/detail/trade_item_detail.htm?bizOrderId=" + model.BuyCode);
}
});
});
function ReadBuyUser() {
$("#select_gmzh").append("<option value='0'>全部</option>");
var param = new Object();
param.CompanyID = 0;
param.KeyName = "cgzh";
$.ajax({
url: "../UserService.asmx/GetListBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
$("#select_gmzh").append("<option value='" + this.Name + "'>" + this.Name + "</option>");
});
}
}
});
}
function Clearcss() {
$("#btn_tj1,#btn_tj2,#btn_tj3,#btn_tj4").attr("class", "btnUnSelected");
}
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) {
shtmls += "<table width='100%' class='trTable'>";
$(md.GoodsList).each(function () {
shtmls += "<tr>";
var imgs = "";
var Num = 0;
// if (this.OutInNum > 0)
// Num = parseInt(this.GoodsNum) - parseInt(this.InGoodsNum) - parseInt(this.OutNum) + parseInt(this.OutInNum);
// else
Num = parseInt(this.GoodsNum) - parseInt(this.InGoodsNum) - parseInt(this.OutNum);
if ($("#chk_wr").is(":checked") == false || Num > 0) {
if ($("#chk_image").is(":checked") == true && this.FirstImgUrl != null && this.FirstImgUrl != "")
imgs = "<img src='" + this.FirstImgUrl + "' alt='' width='50px' height='50px'/>";
shtmls += "<td width='500px' style='font-weight:bolder;font-size:11pt;' align='left'>" + imgs + "<span><a style='cursor: pointer; text-decoration: underline; color: Blue;font-weight:normal;' onclick='LinkGoods(" + this.GoodsId + ")'>" + this.GoodsCode + " &nbsp; &nbsp;" + this.GoodsOldCode + " &nbsp; &nbsp;" + this.GoodsName + " " + this.TypeCode + " </a>&nbsp; &nbsp;</span>[<span class='ms'>" + this.TypeDesc + "</span>] </td><td width='400px' style='font-weight:bolder;font-size:11pt;' align='left'> <span>采购:" + this.GoodsNum + "</span>&nbsp;<span>已入库:" + this.InGoodsNum + "</span>&nbsp;<span>发海外:" + this.OutNum + "</span>&nbsp;<span style='color:green'>未到货:" + Num + "</span></td>";
if (this.IsOrder == null) {
shtmls += "<td> <input cid='" + this.Id + "' onclick='JSCG(" + this.Id + ")' class='btnClass btnClassSave' type='button' value='结束' /></td>";
}
else {
shtmls += "<td><span style='color:red'>已结束</span></td>";
}
shtmls += "</tr>";
}
});
}
shtmls += "</td></tr></table></td><tr>";
$(this).after(shtmls);
$(".ms").each(function () {
var cc = jQuery.trim($(this).html());
if ($(this).html() != "") {
var cl = cc.substr(cc.length - 1, 1);
if (cl == "一" || cl == "二" || cl == "三") {
$(this).css("color", "red");
}
}
});
}
});
}
function JSCG(id) {
if (window.confirm('是否确定结束,结束后未到货数量将不采购?') == false) return;
var param = new Object();
param.id = id;
$.ajax({
url: "../CaiGouServiceNew.asmx/SaveChaseCGNum_New",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
ReadData();
}
});
}
function LinkGoods(GId) {
window.parent.addTab("货物编辑", "HuoWu/HW_GoodsAddForTM.aspx?Title=入库查询&GoodsId=" + GId, true);
}
function GetPostion() {
$("#select_postion").html("<option value='0'>选择</option>");
var param = new Object();
param.StoreId = 0;
param.IsLS = 1;
$.ajax({
url: "../CangKu/CangKuServer.asmx/GetStorePostionForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
$(data.d).each(function () {
$("#select_postion").append("<option value='" + this.PostionId + "'>" + this.PostionCode + "</option>");
});
}
});
}
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 CommandName='cmdBuy' href='###'>{Bind BuyCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购日期";
col.CreateFieldSpan("BuyDate", "yyyy-MM-dd HH:mm");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "入库日期";
col.CreateFieldSpan("DoneDate", "yyyy-MM-dd HH:mm");
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 InGoodsNum}</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 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 = "<div style='width:150px;word-break:break-all;' title='{Bind ErrorInfo}'>{Bind SimpErrorInfo}</div>"; //<a class='linka' cid='{Bind ChaseId}' einfo='{Bind ErrorInfo}'>提醒</a>
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "220px";
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>";
// &nbsp;<input onclick='SCanIn(this)' class='btnClass dgbtnEdit' type='button' 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 ($("#txt_kwcode").val() == "") {
alert("请填写存放地点");
$("#txt_kwcode").focus();
return;
}
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;
param.PostionCode = $("#txt_kwcode").val();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/ChaseInStoreForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
WindowLoadModel.Hide();
if (data.d == 0) {
alert("入库库位编码不正确");
}
else 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 = "";
param.Goods = "";
param.Name = $("#select_gmzh").val();
param.SDate = null;
if ($("#txt_SDate").val() != "")
param.SDate = $("#txt_SDate").val();
//param.State = $("#select_state").val();
param.DHState = DHState;
param.EDate = null;
if ($("#txt_EDate").val() != "")
param.EDate = $("#txt_EDate").val();
// if ($("#txt_Edate").val() != "")
//param.Edate = null;
param.Supplier = $("#txt_gys").val();
param.PostState = $("#select_wlzt").val();
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 || $("#chk_wr").is(":checked") == true)
param.IsDetail = 1;
param.IsGC = 0;
if ($("#chk_gc").is(':checked') == true)
param.IsGC = 1;
param.IsBH = 0;
if ($("#chk_bh").is(':checked') == true)
param.IsBH = 1;
param.GHYC = 0;
if ($("#chk_dhyc").is(':checked') == true)
param.GHYC = 1;
param.SNum = 0;
if ($("#txt_SNum").val() != "")
param.SNum = $("#txt_SNum").val();
param.ENum = 0;
if ($("#txt_ENum").val() != "")
param.ENum = $("#txt_ENum").val();
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "../CaiGouServiceNew.asmx/GetListCG_InchaseForTM",
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();
//$("#" + datagrid1.TableID + " a[cid]").each(function () {
// if ($(this).attr("einfo") == null || $(this).attr("einfo") == "")
// $(this).hide();
//});
$("#" + datagrid1.TableID + " a[no='revice']").each(function () {
if ($(this).html() != "已收货") {
$(this).css("color", "Red");
}
});
$("#" + datagrid1.TableID + " input[CommandName='cmdEdit']").each(function () {
if ($(this).attr("no") == 3) {
$(this).val("查看");
}
});
$("#" + datagrid1.TableID + " input[CommandName='cmdZJRK']").each(function () {
if ($(this).attr("gno") > 0 || $(this).attr("no") == 3) {
$(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_ChaseLookForTM.aspx?IsCheck=Edit&Title=采购入库&ChaseId=" + model.ChaseId, true);
// //window.location.href = "CG_ChaseLook.aspx?ChaseId=" + model.ChaseId;
//else
var kw = "0";
if ($("#txt_kwcode").val() != "")
kw = $("#txt_kwcode").val();
window.parent.addTab("采购单入库", "CaiGou/CG_ChaseInHouseAdd.aspx?Title=采购入库&ChaseId=" + model.ChaseId + "&KW=" + kw, true);
// window.location = "CG_ChaseInHouseAdd.aspx?ChaseId=" + ChaseId;
}
function SCanIn(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_ChaseLookForTM.aspx?IsCheck=Edit&Title=采购入库&ChaseId=" + model.ChaseId, true);
// //window.location.href = "CG_ChaseLook.aspx?ChaseId=" + model.ChaseId;
//else
// var kw = "0";
// if ($("#txt_kwcode").val() != "")
// kw = $("#txt_kwcode").val();
// window.parent.addTab("采购单入库", "CaiGou/CG_ChaseInHouseAddForTM.aspx?Title=采购入库&ChaseId=" + model.ChaseId + "&KW=" + kw, true);
// window.location = "CG_ChaseInHouseAdd.aspx?ChaseId=" + ChaseId;
window.open("CG_ChaseInHouseAddForTM2.aspx?Title=采购入库&ChaseId=" + model.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="form2" runat="server">
<div class="title_ico">
批次入库
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td colspan="7">
<input id="btn_tj1" type="button" value="未到货或部分到货" class="btnSelected"/> <input id="btn_tj3" class="btnUnSelected" type="button" value="全部到货或已结束批次" /> <input id="btn_tj4" class="btnUnSelected" type="button" value="全部" /></td>
</tr>
<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;</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%">
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
<td colspan="4">
</td>
</tr>
<tr id="tr2">
<td class="f1" width="13%">供应商:</td>
<td><input id="txt_gys" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%; height: 15px;">物流状态:</td>
<td width="16%">
<select id="select_wlzt" class="selectClass" style="width: 120px;" name="D5">
<option value="-1">全部</option>
<option value="0">无物流</option>
<option value="1">在途</option>
<option value="2">签收</option>
<option value="3">停滞</option>
<option value="4">异常</option>
</select></td>
<td class="f1">采购账号:</td>
<td>
<select id="select_gmzh" class="selectClass" style="width: 120px;" name="D4">
</select></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" /><label for="chk_mx"><input id="chk_dhyc" type="checkbox" />到货异常</label></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 class="f1" width="13%">未入库数量:</td>
<td colspan="6">
<input id="txt_SNum" class="editTextbox" style="width: 50px;" type="text" />-<input id="txt_ENum" class="editTextbox" style="width:50px;" type="text" /><input id="chk_mx" checked="checked" type="checkbox" /><label for="chk_mx">列出采购货物明细<input id="chk_wr" type="checkbox" />只列出未入货物明细</label><input id="chk_gc" type="checkbox" /><label for="chk_gc">是否工厂</label><input id="chk_bh" type="checkbox" /><label for="chk_bh">是否备货</label><a id="a_gj" style="color:blue;text-decoration:underline;cursor:pointer;display:none"><img src="../images/icon03.jpg" />高级搜索</a><label for="chk_mx"><input id="chk_image" type="checkbox" />显示图片</label></td>
</tr>
<tr>
<td colspan="5">
<font color="color">注:全部到货表示采购单货物全部到齐且都没有问题<br />
有到货异常或者要选库位入库的请点击到货按钮,不要用全部到货;</font></td><td colspan="2">存放地点:<select id="select_postion" class="selectClass" style="width:100px;display:none" name="D3">
</select><input id="txt_kwcode" class="editTextbox" style="width: 120px;" type="text" /></td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</form>
</body>
</html>