|
|
|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseAddForTM.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseAddForTM" %>
|
|
|
|
|
|
|
|
|
|
<!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>
|
|
|
|
|
|
|
|
|
|
<script src="../Scripts/MaskedTextBox.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 datagrid3 = new nblf.ui.DataGrid("DataGrid3");
|
|
|
|
|
var IsNeed = 0;
|
|
|
|
|
var ChaseId = 0;
|
|
|
|
|
var GoodsId = 0;
|
|
|
|
|
var BuyUserId = 0;
|
|
|
|
|
var SupplierId = 0;
|
|
|
|
|
var GoodsState = 0;
|
|
|
|
|
var State = 0;
|
|
|
|
|
var Title = "采购参考";
|
|
|
|
|
var DetailIds = "";
|
|
|
|
|
var WindowLoadModel = new WindowLoad();
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
|
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
|
|
|
WindowLoadModel.Isbgiframe = true;
|
|
|
|
|
WindowLoadModel.Load();
|
|
|
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
|
$("#btn_add").bind("click", function () {
|
|
|
|
|
fopen();
|
|
|
|
|
});
|
|
|
|
|
IsNeed = $.url.param("IsNeed");
|
|
|
|
|
|
|
|
|
|
if (IsNeed == undefined) {
|
|
|
|
|
IsNeed = 0;
|
|
|
|
|
}
|
|
|
|
|
BuyUserId = $.url.param("BuyUserId");
|
|
|
|
|
if (BuyUserId == undefined) {
|
|
|
|
|
BuyUserId = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ChaseId = $.url.param("ChaseId");
|
|
|
|
|
|
|
|
|
|
if (ChaseId == undefined) {
|
|
|
|
|
ChaseId = 0;
|
|
|
|
|
}
|
|
|
|
|
SupplierId = $.url.param("SupplierId");
|
|
|
|
|
|
|
|
|
|
if (SupplierId == undefined) {
|
|
|
|
|
SupplierId = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DetailIds = $.url.param("DetailIds");
|
|
|
|
|
|
|
|
|
|
if (DetailIds == undefined) {
|
|
|
|
|
DetailIds = "";
|
|
|
|
|
}
|
|
|
|
|
Title = $.url.param("Title");
|
|
|
|
|
if (Title == undefined) {
|
|
|
|
|
Title = "采购参考";
|
|
|
|
|
}
|
|
|
|
|
ReadBuyUser();
|
|
|
|
|
GoodsId = $.url.param("GoodsId");
|
|
|
|
|
if (GoodsId == undefined) {
|
|
|
|
|
GoodsId = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ChaseId == 0) {
|
|
|
|
|
|
|
|
|
|
GetCGCode();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$("#btn_pccf").show();
|
|
|
|
|
GetBasePost();
|
|
|
|
|
//$("#txtInName").val(name);
|
|
|
|
|
// CreateDataGrid();
|
|
|
|
|
CreateDataGrid2();
|
|
|
|
|
CreateDataGrid3();
|
|
|
|
|
//GetCheck();
|
|
|
|
|
var dd = new Date();
|
|
|
|
|
|
|
|
|
|
$("#txt_cgrq").val(dd.getFullYear() + "-" + (dd.getMonth() + 1) + "-" + dd.getDate());
|
|
|
|
|
|
|
|
|
|
$("#chk_yccg").bind("click", function () {
|
|
|
|
|
BuyListUpdate();
|
|
|
|
|
if ($(this).is(":checked") == true)
|
|
|
|
|
SelectNoGoods();
|
|
|
|
|
else
|
|
|
|
|
SelectYesGoods();
|
|
|
|
|
});
|
|
|
|
|
$("#btn_Save").bind("click", function () {
|
|
|
|
|
AddBuy();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#btn_Cancel").bind("click", $.fancybox.close);
|
|
|
|
|
$("#cmdSavekddh").bind("click", function () {
|
|
|
|
|
|
|
|
|
|
AddPostCode();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ReadGoods();
|
|
|
|
|
|
|
|
|
|
$("input[ColName='BuyNum']").live("keyup", function () {
|
|
|
|
|
|
|
|
|
|
hesl();
|
|
|
|
|
heji();
|
|
|
|
|
});
|
|
|
|
|
$("input[ColName='BuyMoney']").live("keyup", function () {
|
|
|
|
|
|
|
|
|
|
hesl();
|
|
|
|
|
heji();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#txt_TCFee1,#txt_TCFee2,#txt_TCFee3,#txt_TCFee4").bind("keyup", function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hejitc();
|
|
|
|
|
});
|
|
|
|
|
if (DetailIds != "") {
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
GetBuyGoodsDetailNeed();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (GoodsId > 0) {
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
GetBuyGoodsDetail();
|
|
|
|
|
GetSupplierModel();
|
|
|
|
|
}
|
|
|
|
|
if (SupplierId > 0) {
|
|
|
|
|
GetSupplierModel();
|
|
|
|
|
GetBuyGoodsDetailForSupp();
|
|
|
|
|
}
|
|
|
|
|
if (ChaseId > 0) {
|
|
|
|
|
$("#btn_bz").show();
|
|
|
|
|
GetChaseModel();
|
|
|
|
|
GetChaseGoodsDetail();
|
|
|
|
|
Get_ChaseLsCode();
|
|
|
|
|
GetPost();
|
|
|
|
|
}
|
|
|
|
|
$("#cmdBack").bind("click", function () {
|
|
|
|
|
//window.history.go(-1);
|
|
|
|
|
// window.parent.CloseTab("新增采购", Title);
|
|
|
|
|
window.close();
|
|
|
|
|
});
|
|
|
|
|
$("#chk_xycg").bind("click", function () {
|
|
|
|
|
ReadGoodsDetail();
|
|
|
|
|
});
|
|
|
|
|
$("#txt_yfhj").MaskedTextBox();
|
|
|
|
|
//KeyEvent();
|
|
|
|
|
$('#kw').bind("input propertychange", function () {
|
|
|
|
|
|
|
|
|
|
getContent(this);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#txt_yfhj").bind("keyup", function () {
|
|
|
|
|
heji();
|
|
|
|
|
});
|
|
|
|
|
$(".tbjg").live("click", function () {
|
|
|
|
|
var GId = $(this).attr("GId");
|
|
|
|
|
var price = $("input[GoodsId='" + GId + "']").val();
|
|
|
|
|
if (price == "") {
|
|
|
|
|
alert("请填写要同步的价格");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$("input[colname='BuyMoney'][GId='" + GId + "']").val(price);
|
|
|
|
|
hesl();
|
|
|
|
|
heji();
|
|
|
|
|
});
|
|
|
|
|
$(".tbjghw").live("click", function () {
|
|
|
|
|
var GoId = $(this).attr("GoId");
|
|
|
|
|
var price = $("input[GoodsId='" + GoId + "']").val();
|
|
|
|
|
if (price == "") {
|
|
|
|
|
alert("请填写要同步的价格");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UpdateGoodPrice(GoId, price);
|
|
|
|
|
});
|
|
|
|
|
$("#a_link").bind("click", function () {
|
|
|
|
|
if ($("#txtBuyCode").val() == "")
|
|
|
|
|
return;
|
|
|
|
|
if ($("#select_gmzh").val().indexOf("阿里巴巴") >= 0) {
|
|
|
|
|
// window.open("http://trade.1688.com/order/unify_buyer_detail.htm?orderId=" + $("#txtBuyCode").val());
|
|
|
|
|
window.open("https://trade.1688.com/order/new_step_order_detail.htm?orderId=" + $("#txtBuyCode").val());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
window.open("http://trade.taobao.com/trade/detail/trade_item_detail.htm?bizOrderId=" + $("#txtBuyCode").val());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
$("#btn_pccf").bind("click", function () {
|
|
|
|
|
if (GoodsState > 0) {
|
|
|
|
|
alert("该采购批次已经有到货,不能拆分");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var cobj = $("input[CDID]:checked");
|
|
|
|
|
if (cobj == null || cobj.length == 0) {
|
|
|
|
|
alert("请选择要拆分的货物");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (window.confirm('拆分批次是否已经修改运费,已修改或者不需要修改点确定即可?') == false) return;
|
|
|
|
|
saveCF();
|
|
|
|
|
});
|
|
|
|
|
$("input[QXGID]").live("click", function () {
|
|
|
|
|
|
|
|
|
|
var gid = $(this).attr("QXGID");
|
|
|
|
|
if ($(this).is(":checked") == true) {
|
|
|
|
|
$("input[CGID=" + gid + "]").attr("checked", "checked");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$("input[CGID=" + gid + "]").removeAttr("checked");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
$("#btn_excel").bind("click", function () {
|
|
|
|
|
if (ChaseId == 0) {
|
|
|
|
|
alert("保存后才能导出");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var chaseid = ChaseId;
|
|
|
|
|
//window.open("../TongJi/Report20.aspx?ChaseId=" + chaseid);
|
|
|
|
|
//window.open("http://192.168.12.240:8080/WebReport/ReportServer?reportlet=TMSK%2FChaseForTM.cpt&InventoryBatchID=" + chaseid);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function GetBuyGoodsDetailNeed() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.DetailIds = DetailIds;
|
|
|
|
|
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../CaiGouServiceNew.asmx/GetGoodsSPDetailForNees",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
buylist = data.d;
|
|
|
|
|
// BindDg1();
|
|
|
|
|
if (buylist != null && buylist.length > 0)
|
|
|
|
|
$("#txt_ycbz").val(buylist[0].Remark);
|
|
|
|
|
|
|
|
|
|
if (IsNeed == 1) {
|
|
|
|
|
$("#chk_yccg").attr("checked", "checked");
|
|
|
|
|
//SelectNoGoods();
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
|
|
|
|
|
if (this.BuyNum != null && this.BuyNum <= 0) {
|
|
|
|
|
Array.add(Nobuylist, this);
|
|
|
|
|
Array.remove(buylist, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function GetSupplierModel() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.GoodsId = GoodsId;
|
|
|
|
|
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetSupplierModelForTM",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
$("#txt_gys").val(data.d.SupplierName);
|
|
|
|
|
if (data.d.LinkUrl != null && data.d.LinkUrl != "")
|
|
|
|
|
{
|
|
|
|
|
if (data.d.LinkUrl.indexOf("http") >= 0 || data.d.LinkUrl.indexOf("HTTP") >= 0)
|
|
|
|
|
$("#a_shop").attr("href", data.d.LinkUrl);
|
|
|
|
|
else
|
|
|
|
|
$("#a_shop").attr("href","http://"+data.d.LinkUrl);
|
|
|
|
|
$("#a_shop").show();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var name = "";
|
|
|
|
|
if (data.d.Mobile != null && data.d.Mobile != "")
|
|
|
|
|
name += data.d.Mobile + ";";
|
|
|
|
|
if (data.d.Phone != null && data.d.Phone != "")
|
|
|
|
|
name += data.d.Phone;
|
|
|
|
|
$("#txt_lxfs").val(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function KeyEvent() {
|
|
|
|
|
|
|
|
|
|
$(document).keydown(function (e) {
|
|
|
|
|
e = e || window.event;
|
|
|
|
|
var keycode = e.which ? e.which : e.keyCode;
|
|
|
|
|
if (keycode == 38) {
|
|
|
|
|
if (jQuery.trim($("#append").html()) == "") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
movePrev();
|
|
|
|
|
} else if (keycode == 40) {
|
|
|
|
|
if (jQuery.trim($("#append").html()) == "") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$("#kw").blur();
|
|
|
|
|
if ($(".item").hasClass("addbg")) {
|
|
|
|
|
moveNext();
|
|
|
|
|
} else {
|
|
|
|
|
$(".item").removeClass('addbg').eq(0).addClass('addbg');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (keycode == 13) {
|
|
|
|
|
dojob();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var movePrev = function () {
|
|
|
|
|
$("#kw").blur();
|
|
|
|
|
var index = $(".addbg").prevAll().length;
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
$(".item").removeClass('addbg').eq($(".item").length - 1).addClass('addbg');
|
|
|
|
|
} else {
|
|
|
|
|
$(".item").removeClass('addbg').eq(index - 1).addClass('addbg');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var moveNext = function () {
|
|
|
|
|
var index = $(".addbg").prevAll().length;
|
|
|
|
|
if (index == $(".item").length - 1) {
|
|
|
|
|
$(".item").removeClass('addbg').eq(0).addClass('addbg');
|
|
|
|
|
} else {
|
|
|
|
|
$(".item").removeClass('addbg').eq(index + 1).addClass('addbg');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dojob = function () {
|
|
|
|
|
$("#kw").blur();
|
|
|
|
|
var value = $(".addbg").text();
|
|
|
|
|
$("#kw").val(value);
|
|
|
|
|
|
|
|
|
|
$("#append").hide().html("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function UpdateGoodPrice(goodid, price) {
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.goodid = goodid;
|
|
|
|
|
param.price = price;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/UpdateGoodPrice",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
alert("更新完成!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var Skulist = new Array();
|
|
|
|
|
function GetGoodsSelect() {
|
|
|
|
|
if (jQuery.trim($("#kw").val()) == "")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.Type = $("#select_type").val();
|
|
|
|
|
param.SKU = $("#kw").val();
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../DingDan/DD_OrderService.asmx/GetGoodsModelFromType",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
Skulist = data.d;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getContent(obj) {
|
|
|
|
|
var kw = jQuery.trim($(obj).val());
|
|
|
|
|
|
|
|
|
|
if (kw == "") {
|
|
|
|
|
$("#append").hide().html("");
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var html = "";
|
|
|
|
|
|
|
|
|
|
GetGoodsSelect();
|
|
|
|
|
|
|
|
|
|
if (Skulist != null && Skulist.length > 0) {
|
|
|
|
|
|
|
|
|
|
$(Skulist).each(function () {
|
|
|
|
|
if (this.GoodsName.toUpperCase().indexOf(kw) >= 0 || this.GoodsName.toLowerCase().indexOf(kw) >= 0) {
|
|
|
|
|
html = html + "<div class='item' onmouseenter='getFocus(this)' onClick='getCon(this);' dname='" + this.GoodsName + "' >" + this.GoodsName + "</div>"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (html != "") {
|
|
|
|
|
$("#append").show().html(html);
|
|
|
|
|
} else {
|
|
|
|
|
$("#append").hide().html("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function getFocus(obj) {
|
|
|
|
|
$(".item").removeClass("addbg");
|
|
|
|
|
$(obj).addClass("addbg");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCon(obj) {
|
|
|
|
|
var value = $(obj).text();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#kw").val(value);
|
|
|
|
|
$("#append").hide().html("");
|
|
|
|
|
if ($("#kw").val() != "")
|
|
|
|
|
ReadGoodsDetail();
|
|
|
|
|
}
|
|
|
|
|
//#region 读取
|
|
|
|
|
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>");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var Nobuylist = new Array();
|
|
|
|
|
function SelectNoGoods() {
|
|
|
|
|
|
|
|
|
|
//datagrid1.UpdateDataSource();
|
|
|
|
|
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
|
|
|
|
|
if (this.BuyNum != null && this.BuyNum <= 0) {
|
|
|
|
|
Array.add(Nobuylist, this);
|
|
|
|
|
Array.remove(buylist, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function SelectYesGoods() {
|
|
|
|
|
|
|
|
|
|
if (Nobuylist == null || Nobuylist.length == 0) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(Nobuylist).each(function () {
|
|
|
|
|
var did = this.DetailId;
|
|
|
|
|
var flag = false;
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
var rdid = this.DetailId;
|
|
|
|
|
if (did == rdid) {
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if (flag == false) {
|
|
|
|
|
Array.add(buylist, this);
|
|
|
|
|
Array.remove(Nobuylist, this);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function GetBasePost() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.CompanyID = 0;
|
|
|
|
|
param.KeyName = "gnkd";
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../UserService.asmx/GetListBaseCode",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
$(data.d).each(function () {
|
|
|
|
|
$("#select_post").append("<option value='" + this.ID + "'>" + 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) {
|
|
|
|
|
GoodsState = data.d.GoodsState;
|
|
|
|
|
State = data.d.State;
|
|
|
|
|
|
|
|
|
|
$("#cmdEnd").show();
|
|
|
|
|
|
|
|
|
|
$("#a_cgdh").html(data.d.ChaseCode);
|
|
|
|
|
$("#txtBuyCode").val(data.d.BuyCode);
|
|
|
|
|
|
|
|
|
|
$("#txt_yfhj").val(data.d.PostFee);
|
|
|
|
|
$("#txt_bzxx").val(data.d.Remark);
|
|
|
|
|
$("#txt_ycbz").val(data.d.ErrorInfo);
|
|
|
|
|
$("#a_InName").html(data.d.InName);
|
|
|
|
|
$("#txt_TCFee1").val(data.d.TCFee1);
|
|
|
|
|
$("#txt_TCFee2").val(data.d.TCFee2);
|
|
|
|
|
$("#txt_TCFee3").val(data.d.TCFee3);
|
|
|
|
|
$("#txt_TCFee4").val(data.d.TCFee4);
|
|
|
|
|
$("#txt_TCFee5").val(data.d.TCFee5);
|
|
|
|
|
if (data.d.BuyDate != null)
|
|
|
|
|
$("#txt_cgrq").val(data.d.BuyDate.localeFormat("yyyy-MM-dd"));
|
|
|
|
|
if (data.d.BackDate != null)
|
|
|
|
|
$("#txt_yjdhrq").val(data.d.BackDate.localeFormat("yyyy-MM-dd"));
|
|
|
|
|
$("#txt_gys").val(data.d.Supplier);
|
|
|
|
|
$("#txt_lxfs").val(data.d.SupplierPhone);
|
|
|
|
|
// $("#txtInName").val(data.d.InName);
|
|
|
|
|
|
|
|
|
|
$("#select_gmzh").val(data.d.Account);
|
|
|
|
|
$("#a_hjsl").html(data.d.GoodsNum);
|
|
|
|
|
$("#a_hjje").val(data.d.GoodsMoney);
|
|
|
|
|
if (data.d.IsFactory == 1)
|
|
|
|
|
{
|
|
|
|
|
$("#a_IsGC").html("1");
|
|
|
|
|
$("#chk_IsGC").attr("checked", "checked");
|
|
|
|
|
}
|
|
|
|
|
if (data.d.IsBH == 1) {
|
|
|
|
|
$("#a_IsBH").html("1");
|
|
|
|
|
$("#chk_IsBH").attr("checked", "checked");
|
|
|
|
|
}
|
|
|
|
|
if (data.d.IsError == 1) {
|
|
|
|
|
$("#chk_error").attr("checked", "checked");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (data.d.IsGJ == 1) {
|
|
|
|
|
|
|
|
|
|
$("#chk_IsGJ").attr("checked", "checked");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function Get_ChaseLsCode() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../CaiGouServiceNew.asmx/Get_ChaseLsCode",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
|
|
|
|
|
$("#txt_lsh").val(data.d);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var PostCodeList = new Array();
|
|
|
|
|
function AddPostCode() {
|
|
|
|
|
if ($("#txt_kddh").val() == "") {
|
|
|
|
|
alert("请输入快递单号");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var md = new Object();
|
|
|
|
|
md.Id = 0;
|
|
|
|
|
md.PostCode = $("#txt_kddh").val();
|
|
|
|
|
// md.PostName = $("#select_post option:selected").text();
|
|
|
|
|
md.PostId = 0;//$("#select_post").val();
|
|
|
|
|
Array.add(PostCodeList, md);
|
|
|
|
|
datagrid3.DataBind(PostCodeList);
|
|
|
|
|
$("#txt_kddh").val("");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function GetCheck() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.StepNo = 1;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetCheckConfig",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
$("#a_check").html("下一步审批人:");
|
|
|
|
|
$(data.d).each(function () {
|
|
|
|
|
$("#select_Check").append("<option value=" + this.UserId + ">" + this.Name + "</option>");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#a_check").html("您公司还未设置采购审批功能,采购单无需审批");
|
|
|
|
|
$("#select_Check").hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetCGCode() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetCGGCodeForTM",
|
|
|
|
|
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
$("#a_cgdh").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() {
|
|
|
|
|
$("#append").hide().html("");
|
|
|
|
|
if ($("#chk_xycg").is(":checked") == false && $("#kw").val() == "") {
|
|
|
|
|
alert("请输入要查询的条件或者选择列出当前需缺货的商品");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReadGoodsDetail();
|
|
|
|
|
}
|
|
|
|
|
var buylist = new Array();
|
|
|
|
|
function AddBuy() {
|
|
|
|
|
var slist = datagrid2.GetSelectListModel();
|
|
|
|
|
if (slist == null || slist.length == 0) {
|
|
|
|
|
alert("请选择要购买的物品");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
BuyListUpdate();
|
|
|
|
|
|
|
|
|
|
$(slist).each(function () {
|
|
|
|
|
var did = this.DetailId;
|
|
|
|
|
var flag = false;
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
var rdid = this.DetailId;
|
|
|
|
|
if (did == rdid) {
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if (flag == false)
|
|
|
|
|
Array.add(buylist, this);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BindDg1();
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
$.fancybox.close();
|
|
|
|
|
}
|
|
|
|
|
function BindDg1() {
|
|
|
|
|
datagrid1.DataBind(buylist);
|
|
|
|
|
heji();
|
|
|
|
|
hesl();
|
|
|
|
|
$("input[ColName='BuyNum']").MaskedTextBox();
|
|
|
|
|
$("input[ColName='BuyMoney']").MaskedTextBox();
|
|
|
|
|
}
|
|
|
|
|
function LinkGoods(GId) {
|
|
|
|
|
window.open("../HuoWu/HW_GoodsAddForTM.aspx?Title=订单查询&GoodsId=" + GId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function BindBuyGoods() {
|
|
|
|
|
if (buylist == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var shtml = new Sys.StringBuilder();
|
|
|
|
|
var yrkhtml = "";
|
|
|
|
|
var yrknum = "";
|
|
|
|
|
|
|
|
|
|
var imghtml = "";
|
|
|
|
|
shtml.append("<table class='DataGridTableStyle' style='width: 100%;'>");
|
|
|
|
|
var GId=0;
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
var chks = "";
|
|
|
|
|
var cf = "";
|
|
|
|
|
var cols = 10;
|
|
|
|
|
if (ChaseId > 0) {
|
|
|
|
|
cols = 13;
|
|
|
|
|
var cf = "<th><input type='checkbox' QXGID='" + this.GoodsId + "'/>选择</th><th>拆分数量</th>";
|
|
|
|
|
chks = "<td><input type='checkbox' CDID='" + this.DetailId + "' CGID='" + this.GoodsId + "'/></td><td><input class='editTextbox' style='width: 50px;' type='text' min='0' max='" + this.BuyNum + "' precision='0' colname='CFNum' DID='" + this.DetailId + "' GID='" + this.GoodsId + "' value='" + this.BuyNum + "'/></td>";
|
|
|
|
|
}
|
|
|
|
|
var buyprice = 0;
|
|
|
|
|
if (this.BuyMoney != null)
|
|
|
|
|
buyprice = this.BuyMoney;
|
|
|
|
|
if(this.GoodsId!=GId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//var img="";
|
|
|
|
|
if (ChaseId > 0) {
|
|
|
|
|
yrkhtml = "<th>到货数量</th><th>退货</th>";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(this.FirstImgUrl!=null&&this.FirstImgUrl!="")
|
|
|
|
|
imghtml+= "<img width='100' height='100' alt='' src='" + this.FirstImgUrl + "'>";
|
|
|
|
|
var gcode = this.GoodsCode;
|
|
|
|
|
var goldcode = this.GoodsOldCode;
|
|
|
|
|
if (this.IsTotay == 1) {
|
|
|
|
|
gcode = "<font color='red'>" + this.GoodsCode + "</font>";
|
|
|
|
|
goldcode = "<font color='red'>" + this.GoodsOldCode + "</font>";
|
|
|
|
|
}
|
|
|
|
|
shtml.append("<tr><td colspan='" + cols + "'> 编号:<a onclick='LinkGoods(" + this.GoodsId + ")' style='cursor: pointer; text-decoration: underline; color: blue;'>" + gcode + "</a> " + goldcode + " 货物名称:" + this.GoodsName + " 价格<input class='editTextbox' style='width: 50px;' type='text' min='0' max='10000000' GoodsId='" + this.GoodsId + "' value='" + buyprice + "'><a style='cursor: pointer; text-decoration: underline; color: blue;' GId='" + this.GoodsId + "' class='tbjg'>同步价格</a> <a style='cursor: pointer; text-decoration: underline; color: blue;' GoId='" + this.GoodsId + "' class='tbjghw'>同步价格到货物</a></td></tr>");
|
|
|
|
|
shtml.append("<tr class='HeaderStyle'>" + cf + "<th>型号</th><th>描述</th><th>库存数量</th><th>购买在途</th><th>订单需求</th><th>剩余参考</th><th>备货数量</th><th>采购单价</th><th>采购数量</th>" + yrkhtml + "</tr>");
|
|
|
|
|
}
|
|
|
|
|
if (ChaseId > 0) {
|
|
|
|
|
|
|
|
|
|
yrknum = "<td><span>" + this.InGoodsNum + "</span></td><td><span>" + this.BackNum + "</span></td>";
|
|
|
|
|
}
|
|
|
|
|
var min = 0;
|
|
|
|
|
if (this.BackNum != null)
|
|
|
|
|
min += parseInt(this.BackNum);
|
|
|
|
|
if (this.InGoodsNum != null)
|
|
|
|
|
min += parseInt(this.InGoodsNum);
|
|
|
|
|
|
|
|
|
|
shtml.append("<tr class='DataGridRowStyle'>" + chks + "<td><a>" + this.TypeCode + "</a></td><td><span class='ms'> " + this.TypeDesc + " </span></td><td><span>" + this.GoodsNum + "</span></td><td><span>" + this.GoodsInNum + "</span></td><td><span>" + this.GoodsPlanNum + "</span></td><td><span>" + this.GoodsLeftNum + "</span></td><td><span>" + this.SafeNum + "</span></td><td><input class='editTextbox' style='width: 50px;' type='text' min='0' max='10000000' precision='2' colname='BuyMoney' DID='" + this.DetailId + "' GID='" + this.GoodsId + "' value='" + buyprice + "'/></td><td><input class='editTextbox' style='width: 50px;' type='text' min='" + min + "' max='10000000' precision='0' colname='BuyNum' DID='" + this.DetailId + "' GID='" + this.GoodsId + "' oldnum='" + this.BuyNum + "' value='" + this.BuyNum + "'/></td>" + yrknum + "</tr>");
|
|
|
|
|
|
|
|
|
|
GId=this.GoodsId;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
shtml.append("</table>");
|
|
|
|
|
shtml.append("<div>"+imghtml+"</div>")
|
|
|
|
|
$("#dg_Goods").html(shtml.toString());
|
|
|
|
|
$("input[colname='BuyNum']").MaskedTextBox();
|
|
|
|
|
$("input[colname='BuyMoney']").MaskedTextBox();
|
|
|
|
|
$("input[colname='CFNum']").MaskedTextBox();
|
|
|
|
|
$(".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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
hesl();
|
|
|
|
|
heji();
|
|
|
|
|
}
|
|
|
|
|
function ReadGoodsDetail() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.Type = $("#select_type").val();
|
|
|
|
|
param.IsLeft = 0;
|
|
|
|
|
if ($("#chk_xycg").is(":checked") == true)
|
|
|
|
|
param.IsLeft = 1;
|
|
|
|
|
param.GoodsCode = $("#kw").val();
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetGoodsSPDetailFromTypeForTM",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
datagrid2.DataBind(data.d);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function GetBuyGoodsDetail() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.BuyUserId = BuyUserId;
|
|
|
|
|
param.GoodsId = GoodsId;
|
|
|
|
|
param.SupplierId = SupplierId;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetGoodsSPDetailForTM",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
buylist = data.d;
|
|
|
|
|
// BindDg1();
|
|
|
|
|
if (buylist != null && buylist.length > 0)
|
|
|
|
|
$("#txt_ycbz").val(buylist[0].Remark);
|
|
|
|
|
|
|
|
|
|
if (IsNeed == 1) {
|
|
|
|
|
$("#chk_yccg").attr("checked", "checked");
|
|
|
|
|
//SelectNoGoods();
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
|
|
|
|
|
if (this.BuyNum != null && this.BuyNum <= 0) {
|
|
|
|
|
Array.add(Nobuylist, this);
|
|
|
|
|
Array.remove(buylist, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function GetBuyGoodsDetailForSupp() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.SupplierId = SupplierId;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../CaiGouServiceNew.asmx/GetGoodsSPDetailFromSupplie",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
buylist = data.d;
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
//BindDg1();
|
|
|
|
|
//if (IsNeed == 1) {
|
|
|
|
|
// $("#chk_yccg").attr("checked", "checked")
|
|
|
|
|
// SelectNoGoods();
|
|
|
|
|
//}
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetChaseGoodsDetail() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetPurchaseTableGoods",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
buylist = data.d;
|
|
|
|
|
BindBuyGoods();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetPost() {
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/GetchasePostList",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d != null) {
|
|
|
|
|
PostCodeList = data.d;
|
|
|
|
|
datagrid3.DataBind(PostCodeList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.CreateFieldSpan("GoodsNum", "");
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "购买在途";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CreateFieldSpan("GoodsInNum", "");
|
|
|
|
|
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "订单需求";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CreateFieldSpan("GoodsPlanNum", "");
|
|
|
|
|
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "剩余参考";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CreateFieldSpan("GoodsLeftNum", "");
|
|
|
|
|
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "采购单价";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CellTemplate = "<input type='text' min='0' max='10000000' precision='2' style='width:50px;' class='editTextbox' ColName='BuyMoney' value='{Bind BuyMoney}'/>";
|
|
|
|
|
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "采购数量";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CellTemplate = "<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/>";
|
|
|
|
|
|
|
|
|
|
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 = "SKU";
|
|
|
|
|
|
|
|
|
|
col.CellTemplate = "<span>{Bind SKU1}<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 GoodsNum}<span>";
|
|
|
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "购买途中";
|
|
|
|
|
|
|
|
|
|
col.CellTemplate = "<span>{Bind GoodsInNum}<span>";
|
|
|
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "订单需求";
|
|
|
|
|
// col.Width = "100px";
|
|
|
|
|
col.CreateFieldSpan("GoodsPlanNum", "");
|
|
|
|
|
|
|
|
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "参考";
|
|
|
|
|
|
|
|
|
|
col.CellTemplate = "<span>{Bind GoodsLeftNum}<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 CreateDataGrid3() {
|
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "快递单号";
|
|
|
|
|
|
|
|
|
|
col.CellTemplate = "<span>{Bind PostCode}<span>";
|
|
|
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
|
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "操作";
|
|
|
|
|
col.Width = "100px";
|
|
|
|
|
col.CellTemplate = "<input onclick='DelPost(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
|
|
|
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
|
|
|
|
|
|
datagrid3.IsFixHeader = false;
|
|
|
|
|
datagrid3.ShowIndexColumn = false;
|
|
|
|
|
datagrid3.AllowPaging = false;
|
|
|
|
|
//datagrid1.Height = "260px";
|
|
|
|
|
datagrid3.SelectMode = nblf.ui.SelectMode.None;
|
|
|
|
|
datagrid3.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) {
|
|
|
|
|
if (window.confirm('确定要删除吗?') == false) return;
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var Imgs = new Array();
|
|
|
|
|
function uploadimg() {
|
|
|
|
|
$('#fuContainer').uploadify({
|
|
|
|
|
langFile: "../Scripts/uploadify/uploadify-lang-zh_CN.js",
|
|
|
|
|
swf: '../Scripts/uploadify/uploadify.swf',
|
|
|
|
|
uploader: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=attached/images',
|
|
|
|
|
checkExisting: '../GlobalAshx/UploadifyCheck.ashx',
|
|
|
|
|
cancelImage: '../themes/default/images/tabs_close.gif',
|
|
|
|
|
buttonText: '选择图片',
|
|
|
|
|
method: 'post',
|
|
|
|
|
requeueErrors: true,
|
|
|
|
|
auto: true,
|
|
|
|
|
multi: true, //是否允许多文件上传
|
|
|
|
|
sizeLimit: 0, //控制上传文件的大小,单位byte
|
|
|
|
|
fileTypeDesc: '*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.ico;',
|
|
|
|
|
fileTypeExts: '*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.ico;',
|
|
|
|
|
height: 20, //浏览按钮高
|
|
|
|
|
uploadLimit: 999, //同时上传多小个文件
|
|
|
|
|
queueSizeLimit: 999, //队列允许的文件总数
|
|
|
|
|
successTimeout: 999,
|
|
|
|
|
removeCompleted: true, //当上传成功后是否将该Item删除
|
|
|
|
|
// 'scriptData': {'name':'ssd','id':'123'},
|
|
|
|
|
// 'folder':'1',
|
|
|
|
|
onUploadSuccess: function (event, response, status) {
|
|
|
|
|
if (response == "") return;
|
|
|
|
|
|
|
|
|
|
var DataModel = Sys.Serialization.JavaScriptSerializer.deserialize(response);
|
|
|
|
|
|
|
|
|
|
//var FileId = DataModel.Id;
|
|
|
|
|
var Url = "../attached/images/" + DataModel.FileName;
|
|
|
|
|
//var model = new Object();
|
|
|
|
|
//model.FileId = FileId;
|
|
|
|
|
//var FactName = DataModel.FactName.substring(0, DataModel.FactName.length - 4);
|
|
|
|
|
//model.PhotoName = FactName;
|
|
|
|
|
//model.AlbumId = 0;
|
|
|
|
|
//model.PhotoDesc = "";
|
|
|
|
|
//Array.add(Imgs, model);
|
|
|
|
|
$("#div_img").append("<a><img alt='' src='" + Url + "' width='50px' height='50px' /></a>");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function hejitc() {
|
|
|
|
|
var je = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("input[tc='tc']").each(function () {
|
|
|
|
|
|
|
|
|
|
if ($(this).val() != "") {
|
|
|
|
|
|
|
|
|
|
je += parseFloat($(this).val());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
$("#txt_TCFee5").val(je.toFixed(2));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function heji() {
|
|
|
|
|
var je = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("input[ColName='BuyMoney']").each(function () {
|
|
|
|
|
var obj2 = $(this).parent().parent().find("input[ColName='BuyNum']");
|
|
|
|
|
if ($(this).val() != "" && obj2 != null && $(obj2).val() != "") {
|
|
|
|
|
|
|
|
|
|
je += parseFloat($(this).val()) * parseFloat($(obj2).val());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if ($("#txt_yfhj").val() != "") {
|
|
|
|
|
|
|
|
|
|
je += parseFloat($("#txt_yfhj").val());
|
|
|
|
|
}
|
|
|
|
|
$("#a_hjje").val(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 BuyListUpdate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (buylist != null)
|
|
|
|
|
{
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
var Did = this.DetailId;
|
|
|
|
|
|
|
|
|
|
if ($("input[colname='BuyMoney'][DID='"+Did+"']").length > 0)
|
|
|
|
|
{
|
|
|
|
|
var price=$("input[colname='BuyMoney'][DID='"+Did+"']").val();
|
|
|
|
|
this.BuyMoney = price;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ($("input[colname='BuyNum'][DID='" + Did + "']").length > 0) {
|
|
|
|
|
var num = $("input[colname='BuyNum'][DID='" + Did + "']").val();
|
|
|
|
|
this.BuyNum = num;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ($("input[colname='CFNum'][DID='" + Did + "']").length > 0) {
|
|
|
|
|
|
|
|
|
|
var cfnum = $("input[colname='CFNum'][DID='" + Did + "']").val();
|
|
|
|
|
if ($("input[CDID='" + Did + "']").is(":checked") == true)
|
|
|
|
|
this.CFNum = cfnum;
|
|
|
|
|
else
|
|
|
|
|
this.CFNum = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function save() {
|
|
|
|
|
|
|
|
|
|
if ($("#txt_cgrq").val() == "") {
|
|
|
|
|
alert("请填写采购日期");
|
|
|
|
|
$("#txt_cgrq").focus();
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (buylist == null || buylist.length <= 0) {
|
|
|
|
|
alert("请选择要采购的货物");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ($("#txt_yfhj").val() == "") {
|
|
|
|
|
alert("请填写运费");
|
|
|
|
|
$("#txt_yfhj").focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$("#cmdSave").attr("disabled", "disabled");
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
BuyListUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var error = "";
|
|
|
|
|
$(buylist).each(function () {
|
|
|
|
|
if (ChaseId>0)
|
|
|
|
|
{
|
|
|
|
|
if (this.BuyNum == null && this.BuyNum == "")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
error += this.GoodsOldCode + " " + this.TypeCode + "采购数量没填;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.BuyNum != 0 && this.BuyMoney=="") {
|
|
|
|
|
error += this.GoodsOldCode+" "+this.TypeCode +"采购单价未填写;";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (error != "") {
|
|
|
|
|
alert(error);
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
$("#cmdSave").removeAttr("disabled");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
|
|
|
|
|
var model = new Object();
|
|
|
|
|
model.ChaseId = ChaseId;
|
|
|
|
|
model.ChaseCode = $("#a_cgdh").html();
|
|
|
|
|
model.InName = $("#a_InName").html();
|
|
|
|
|
model.GoodsState = 0;
|
|
|
|
|
model.Remark = $("#txt_bzxx").val();
|
|
|
|
|
model.ErrorInfo = $("#txt_ycbz").val();
|
|
|
|
|
// model.BuyDate = $("#txt_cgrq").val();
|
|
|
|
|
model.BackDate = $("#txt_yjdhrq").val();
|
|
|
|
|
model.Supplier = $("#txt_gys").val();
|
|
|
|
|
model.SupplierPhone = $("#txt_lxfs").val();
|
|
|
|
|
model.PostFee = $("#txt_yfhj").val();
|
|
|
|
|
model.GoodsNum = $("#a_hjsl").html();
|
|
|
|
|
model.GoodsMoney = $("#a_hjje").val();
|
|
|
|
|
if ($("#a_IsGC").html() != "")
|
|
|
|
|
model.OldFactory = $("#a_IsGC").html();
|
|
|
|
|
else
|
|
|
|
|
model.OldFactory = 0;
|
|
|
|
|
model.IsFactory = 0;
|
|
|
|
|
if ($("#chk_IsGC").is(":checked") == true)
|
|
|
|
|
model.IsFactory = 1;
|
|
|
|
|
model.IsBH = 0;
|
|
|
|
|
if ($("#chk_IsBH").is(":checked") == true)
|
|
|
|
|
model.IsBH = 1;
|
|
|
|
|
if ($("#a_IsBH").html() != "")
|
|
|
|
|
model.OldBH = $("#a_IsBH").html();
|
|
|
|
|
else
|
|
|
|
|
model.OldBH = 0;
|
|
|
|
|
|
|
|
|
|
if ($("#select_gmzh").val() == "0")
|
|
|
|
|
model.Account = "";
|
|
|
|
|
else
|
|
|
|
|
model.Account = $("#select_gmzh").val();
|
|
|
|
|
model.BuyCode = $("#txtBuyCode").val();
|
|
|
|
|
|
|
|
|
|
// model.InName = $("#txtInName").val();
|
|
|
|
|
model.TCFee1 = $("#txt_TCFee1").val();
|
|
|
|
|
model.TCFee2 = $("#txt_TCFee2").val();
|
|
|
|
|
model.TCFee3 = $("#txt_TCFee3").val();
|
|
|
|
|
model.TCFee4 = $("#txt_TCFee4").val();
|
|
|
|
|
model.TCFee5 = $("#txt_TCFee5").val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.IsDelete = 0;
|
|
|
|
|
if ($("#select_Check").val() != null && $("#select_Check").val() != "") {
|
|
|
|
|
model.CheckUid = $("#select_Check").val();
|
|
|
|
|
model.State = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
model.CheckUid = 0;
|
|
|
|
|
model.State = 1;
|
|
|
|
|
}
|
|
|
|
|
model.IsGJ = 0;
|
|
|
|
|
if ($("#chk_IsGJ").is(":checked") == true)
|
|
|
|
|
model.IsGJ = 1;
|
|
|
|
|
param.model = model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
param.Goodslist = buylist
|
|
|
|
|
param.Postlist = PostCodeList;
|
|
|
|
|
var purl = "CaiGouService.asmx/SaveChaseForTM2";
|
|
|
|
|
if (ChaseId > 0)
|
|
|
|
|
purl = "CaiGouService.asmx/SaveChaseForTM";
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: purl,
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
|
|
|
|
|
if (ChaseId > 0)
|
|
|
|
|
SaveCGNum(1);
|
|
|
|
|
else
|
|
|
|
|
SaveCGNum(0);
|
|
|
|
|
$("#cmdSave").removeAttr("disabled");
|
|
|
|
|
//if (model.State == 0)
|
|
|
|
|
// alert("提交成功,等待审批");
|
|
|
|
|
//else
|
|
|
|
|
alert("提交成功");
|
|
|
|
|
ChaseId = data.d;
|
|
|
|
|
window.location.href ="CG_ChaseAddForTM.aspx?ChaseId=" + ChaseId;
|
|
|
|
|
// window.close();
|
|
|
|
|
// window.parent.CloseTab("新增采购", Title);
|
|
|
|
|
// window.location.href = "CG_Chase.aspx";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
function SaveCGNum(xz) {
|
|
|
|
|
|
|
|
|
|
var Goodslist2=new Array();
|
|
|
|
|
var param = new Object();
|
|
|
|
|
$("input[oldnum]").each(function () {
|
|
|
|
|
var OldBuyNum = 0;
|
|
|
|
|
if (xz==1)
|
|
|
|
|
OldBuyNum = $(this).attr("oldnum");
|
|
|
|
|
|
|
|
|
|
var md = new Object();
|
|
|
|
|
md.OldBuyNum = OldBuyNum;
|
|
|
|
|
md.DetailId = $(this).attr("DID");
|
|
|
|
|
Array.add(Goodslist2, md);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
param.lscode = $("#txt_lsh").val();
|
|
|
|
|
param.Goodslist = buylist;
|
|
|
|
|
param.Goodslist2 = Goodslist2;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../CaiGouServiceNew.asmx/SaveChaseCGNUm",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//#region 拆分
|
|
|
|
|
function saveCF() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BuyListUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
|
|
|
|
|
|
|
var model = new Object();
|
|
|
|
|
model.ChaseId = ChaseId;
|
|
|
|
|
model.ChaseCode = $("#a_cgdh").html();
|
|
|
|
|
model.PostFee = $("#txt_yfhj").val();
|
|
|
|
|
// model.ChaseCode = $("#a_cgdh").html();
|
|
|
|
|
param.model = model;
|
|
|
|
|
param.Goodslist = buylist;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/SaveCFChaseForTM",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d>0)
|
|
|
|
|
window.open("CG_ChaseAddForTM.aspx?Title=采购单&ChaseId=" + data.d);
|
|
|
|
|
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
function saveBZ()
|
|
|
|
|
{
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
param.IsError = 0;
|
|
|
|
|
if ($("#chk_error").is(":checked") == true)
|
|
|
|
|
param.IsError = 1;
|
|
|
|
|
param.ErrorInfo = $("#txt_ycbz").val();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/SaveChaseErrorInfo",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
alert("保存成功");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveend()
|
|
|
|
|
{
|
|
|
|
|
if (window.confirm('确定要结束该吗?') == false) return;
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.ChaseId = ChaseId;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "CaiGouService.asmx/SaveChaseEnd",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
alert("保存成功");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
#container {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 23%;
|
|
|
|
|
top: 0%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#content {
|
|
|
|
|
float: left;
|
|
|
|
|
position: relative;
|
|
|
|
|
right: 20%;
|
|
|
|
|
background: #BBFFEE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.schinput {
|
|
|
|
|
border: 0;
|
|
|
|
|
width: 200px;
|
|
|
|
|
height: 34px;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
padding: 3px 5px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.addbg {
|
|
|
|
|
background: #9999FF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.first {
|
|
|
|
|
border: solid #CCDDFF 2px;
|
|
|
|
|
width: 210px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#append {
|
|
|
|
|
border: solid #CCDDFF 2px;
|
|
|
|
|
border-top: 0;
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</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 style="height: 38px">
|
|
|
|
|
<td style="width: 110px;" class="f1">
|
|
|
|
|
<select id="select_type" class="selectClass" style="width: 100px;">
|
|
|
|
|
<option value="2">货物编号:</option>
|
|
|
|
|
<option value="1">货物SKU:</option>
|
|
|
|
|
<option value="3">货物名称:</option>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
<td colspan="2" width="250px">
|
|
|
|
|
<div id="container">
|
|
|
|
|
<div id="content">
|
|
|
|
|
<div class="first">
|
|
|
|
|
<input id="kw" class="schinput" /></div>
|
|
|
|
|
<div id="append"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td align="left">
|
|
|
|
|
<input id="txt_hwbhmc" class="editTextbox" style="width: 120px; display: none" type="text" />
|
|
|
|
|
<input id="chk_xycg" type="checkbox" />列出当前需缺货的商品
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td>
|
|
|
|
|
<input id="Button1" type="button" value="查询" class="btnClass btnClassFind" onclick="AddGoods();" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td align="left" colspan="5">
|
|
|
|
|
<div style="height: 280px; overflow: auto">
|
|
|
|
|
<div id="DataGrid2"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td align="center" colspan="5">
|
|
|
|
|
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="添 加" /> <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="a_cgdh"></a>
|
|
|
|
|
</td>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
<font color="red" style="font-weight: bolder">*</font>
|
|
|
|
|
采购日期:
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_cgrq" class="editTextbox" onfocus="WdatePicker()" style="width: 200px;" type="text" />
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">购买订单号:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txtBuyCode" type="text" style="width: 200px;" class="editTextbox" /><a style="cursor: pointer; text-decoration: underline; color: blue;" id="a_link">链接</a></td>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
预计到货日期:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_yjdhrq" class="editTextbox" onfocus="WdatePicker()" style="width: 200px;" type="text" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
<font color="red" style="font-weight: bolder">*</font>
|
|
|
|
|
运费合计:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_yfhj" type="text" min='0' max='10000000' precision='2' style="width: 200px;" class="editTextbox" value="0"/><input id="chk_IsGJ" type="checkbox" />是否需要改价</td>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
<font color="red" style="font-weight: bolder">*</font>
|
|
|
|
|
购买账号:
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td>
|
|
|
|
|
<select id="select_gmzh" class="selectClass" style="width: 200px;">
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">供应商:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_gys" type="text" style="width: 200px;" class="editTextbox" /><a id="a_shop" target="_blank" style="color:blue;text-decoration:underline;display:none" >访问供应商店铺</a> </td>
|
|
|
|
|
<td style="width: 120px" class="f1">联系方式:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_lxfs" type="text" style="width: 200px;" class="editTextbox" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">是否工厂:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="chk_IsGC" type="checkbox" />是否工厂<a id="a_IsGC" style="display:none"></a> <input id="chk_IsBH" type="checkbox" />是否备货<a id="a_IsBH" style="display:none"></a></td>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
流水号:</td>
|
|
|
|
|
<td>
|
|
|
|
|
<input id="txt_lsh" type="text" style="width: 200px;" class="editTextbox" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">头程费:</td>
|
|
|
|
|
<td colspan=3>国内货代
|
|
|
|
|
<input id="txt_TCFee1" type="text" min='0' max='10000000' precision='2'
|
|
|
|
|
style="width: 80px;" tc="tc" class="editTextbox" value="0"/>美元 国外货代
|
|
|
|
|
<input id="txt_TCFee2" tc="tc" type="text" min='0' max='10000000' precision='2'
|
|
|
|
|
style="width: 80px;" class="editTextbox" value="0"/>美元 海运
|
|
|
|
|
<input id="txt_TCFee3" tc="tc" type="text" min='0' max='10000000' precision='2'
|
|
|
|
|
style="width: 80px;" class="editTextbox" value="0"/>美元 清关
|
|
|
|
|
<input id="txt_TCFee4" tc="tc" type="text" min='0' max='10000000' precision='2'
|
|
|
|
|
style="width: 80px;" class="editTextbox" value="0"/>美元 合计:<input
|
|
|
|
|
id="txt_TCFee5" type="text" min='0' max='10000000' precision='2'
|
|
|
|
|
style="width: 80px;" class="editTextbox" value="0"/>美元 </td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">操作人:</td>
|
|
|
|
|
<td colspan="3">
|
|
|
|
|
<a id="a_InName"></a></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">相关信息:</td>
|
|
|
|
|
<td colspan="3">
|
|
|
|
|
<textarea id="txt_bzxx" cols="100" rows="3" style="width: 90%"></textarea>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">异常备注:<br />
|
|
|
|
|
<input id="chk_error" type="checkbox" />勾选异常</td>
|
|
|
|
|
<td colspan="3">
|
|
|
|
|
<textarea id="txt_ycbz" cols="100" rows="3" style="width: 90%" name="S1"></textarea><br />
|
|
|
|
|
<input id="btn_bz" type="button" value="保存备注" class="btnClass btnClassSave" onclick="saveBZ();" style="display:none"/></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> <a id="btn_pccf"
|
|
|
|
|
style="cursor: pointer; text-decoration: underline; color: blue;display:none">批次拆分</a> <input id="chk_yccg" type="checkbox" /><font color="red">隐藏同货物编采购参考为0的物品</font> <br />
|
|
|
|
|
|
|
|
|
|
<div id="dg_Goods" style="width:100%;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
</td>
|
|
|
|
|
<td colspan="2">数量合计:<a id="a_hjsl" style="font-size: x-large; color: Red"></a> 价格合计:<input id="a_hjje" type="text" min='0' max='10000000' precision='2' style="width: 90px;font-size: x-large; color: Red" class="editTextbox" />元</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="width: 120px" class="f1">快递信息:</td>
|
|
|
|
|
<td colspan="3" align="left">
|
|
|
|
|
<select id="select_post" class="selectClass" style="width: 120px;display:none">
|
|
|
|
|
</select>
|
|
|
|
|
<input id="txt_kddh" type="text" style="width: 150px;" class="editTextbox" /><input id="cmdSavekddh" type="button" value="添加" class="btnClass btnClassAdd" /><br />
|
|
|
|
|
<div id="DataGrid3" class="DataGridStyle" style="width: 450px; margin-left: 0px"></div>
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr style="display:none">
|
|
|
|
|
<td style="width: 120px" class="f1">采购审批:</td>
|
|
|
|
|
<td colspan="3">
|
|
|
|
|
<a id="a_check"></a>
|
|
|
|
|
<select id="select_Check" name="D1">
|
|
|
|
|
</select></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" />
|
|
|
|
|
<input id="cmdEnd" type="button" value="结束采购批次" class="btnClass btnClassSave" style="display:none" onclick="saveend();" /> <input id="btn_excel" class="btnClass btnClassExcelTemplate" type="button" value="导出批次" style="display:none"/></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|