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.

1253 lines
42 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_ChaseAddForTM3.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseAddForTM3" %>
<!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("dg_Goods");
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 StoreId = 0;
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
$("#btn_add").bind("click", function () {
ReadGoodsDetail();
fopen();
});
ChaseId = $.url.param("ChaseId");
if (ChaseId == undefined)
ChaseId = 0;
StoreId = $.url.param("StoreId");
if (StoreId == undefined)
StoreId = 0;
CreateDataGrid();
CreateDataGrid2();
CreateDataGrid3();
$("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 (ChaseId > 0) {
GetChaseModel();
ReadGoodsDetail2();
// GetSupplierModel();
}
else
GetCGCode();
$("#cmdBack").bind("click", function () {
//window.history.go(-1);
// window.parent.CloseTab("新增采购", Title);
window.close();
});
$("#btn_Save").bind("click", function () {
AddBuy();
});
$("#txt_yfhj").MaskedTextBox();
//KeyEvent();
// $('#kw').bind("input propertychange", function () {
// getContent(this);
// });
$("input[tjsd]").live("keyup", function () {
HJSD();
});
});
// 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 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();
$("#select_store").val(StoreId);
$("#a_cgdh").html(data.d.ChaseCode);
$("#txtBuyCode").val(data.d.BuyCode);
$("#txt_bzxx").val(data.d.Remark);
$("#select_wlzt").val(data.d.PostState);
$("#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_cyrq").val(data.d.BuyDate.localeFormat("yyyy-MM-dd"));
if (data.d.BackDate != null)
$("#txt_yjdhrq").val(data.d.BackDate.localeFormat("yyyy-MM-dd"));
$("#a_hjsl").html(data.d.GoodsNum);
$("#a_hjlf").val(data.d.TSoild);
}
}
});
}
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 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 ReadGoodsDetail() {
var param = new Object();
var ids = "";
if (buylist != null) {
$(buylist).each(function () {
ids += this.Id + ",";
});
}
if (ChaseId > 0)
param.ids = "";
else
param.ids = ids;
// ids;
param.PageSize = datagrid2.Get_PageSize();
param.PageIndex = datagrid2.Get_PageIndex();
param.Type = $("#select_type").val();
param.GoodsName = $("#txt_code").val();
WindowLoadModel.Show();
$.ajax({
url: "../CaiGouServiceNew.asmx/GetGoodsForHWCOut",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
datagrid2.Set_RowCount(data.d.RowCount);
datagrid2.DataBind(data.d.DataSource);
}
});
}
function ReadGoodsDetail2() {
var param = new Object();
param.ChaseId = ChaseId;
WindowLoadModel.Show();
$.ajax({
url: "../CaiGouServiceNew.asmx/GetPurchaseGoodsOut2",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
datagrid1.DataBind(data.d);
$("input[tjsd]").MaskedTextBox();
buylist = new Array();
// var ids = "";
$(data.d).each(function () {
// ids += this.Id + ",";
Array.add(buylist, this);
});
$("a[sd=0]").css("color", "red");
HJSD();
}
});
}
var buylist = new Array();
var ids2 = "";
function AddBuy() {
var slist = datagrid2.GetSelectListModel();
if (slist == null || slist.length == 0) {
alert("请选择物品");
return;
}
if (buylist == null || buylist.length == 0)
buylist = new Array();
$(slist).each(function () {
var id2 = this.Id;
var OutNum = this.OutNum;
this.SJOutNum = this.OutNum;
var ChaseCode = this.BuyCode;
if (ChaseCode == null || ChaseCode == "")
ChaseCode = this.ChaseCode;
this.Chase_Code = ChaseCode;
var fg = 0;
$(buylist).each(function () {
if (id2 == this.Id) {
fg = 1;
this.SJOutNum = this.SJOutNum + OutNum;
this.Chase_Code = ChaseCode;
}
});
if (fg == 0) {
ids2 += this.Id + ",";
Array.add(buylist, this);
}
});
datagrid1.DataBind(buylist);
$("a[sd=0]").css("color", "red");
HJSD();
$("input[colname='SJOutNum']").MaskedTextBox();
// GetChaseGoodsDetail();
$.fancybox.close();
}
function GetChaseGoodsDetail() {
var param = new Object();
param.Ids = ids2;
$.ajax({
url: "CaiGouService.asmx/GetGoodsForHWCOutList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
if (buylist == null)
buylist = new Array();
$(data.d).each(function () {
Array.add(buylist, this);
});
datagrid1.DataBind(buylist);
$("a[sd=0]").css("color", "red");
HJSD();
}
}
});
}
function HJSD() {
var sd = 0;
var sl = 0;
$("input[tjsd]").each(function () {
var ssd = $(this).attr("tjsd");
if ($(this).val() != "" && ssd != "") {
sl += parseInt($(this).val());
sd += parseInt($(this).val()) * parseFloat(ssd);
}
});
$("#a_hjsl").html(sl);
$("#a_hjlf").html(sd.toFixed(2));
}
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 CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物编号";
col.CellTemplate = "<a style='color:blue;cursor:pointer' target='blank' href='../HuoWu/HW_GoodsDetailList2.aspx?GoodsCode={Bind GoodsCode}'>{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.CreateFieldSpan("TypeDesc", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "单个体积";
// col.Width = "100px";
col.CellTemplate = "<a sd='{Bind Solid}'>{Bind Solid}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购单号";
// col.Width = "100px";
col.CellTemplate = "<a>{Bind Chase_Code}</a>";
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.CellTemplate = "<input type='text' min='0' max='100' precision='3' style='width:50px;' class='editTextbox' ColName='GoodsRate' value='{Bind GoodsRate}'/>%";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "海外仓数量";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='{Bind OutNum}' precision='0' style='width:50px;' class='editTextbox' ColName='SJOutNum' tjsd='{Bind Solid}' value='{Bind SJOutNum}'/>";
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);
var Id2 = model.Id;
$(buylist).each(function () {
if (this.Id == Id2)
Array.remove(buylist, this);
});
if (ChaseId > 0) {
var param1 = new Object();
param1.Id = Id2;
$.ajax({
url: "CaiGouService.asmx/DeleteHWCGoods2",
data: Sys.Serialization.JavaScriptSerializer.serialize(param1),
dataType: "json",
async: false,
success: function (data) {
}
});
}
alert("删除成功");
datagrid1.Del_Row(rowindex);
HJSD();
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买单号";
col.CellTemplate = "<span>{Bind BuyCode}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购批次号";
col.CellTemplate = "<span>{Bind ChaseCode}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货号";
col.CellTemplate = "<span>{Bind GoodsCode}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<span>{Bind GoodsName}<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 Solid}立方<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 OutNum}<span>";
Array.add(datagrid2.Columns, col);
datagrid2.SetPageSize(10);
datagrid2.SetPageIndex(1);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = true;
//datagrid1.Height = "260px";
datagrid2.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid2.Init();
datagrid2.add_PageIndexChanged(function () { ReadData(); });
}
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());
}
});
$("#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 ($("#select_store").val() == "0") {
alert("请选择发往仓库");
return;
}
datagrid1.UpdateDataSource();
if (datagrid1.DataSource == null || datagrid1.DataSource.length <= 0) {
alert("请选择要出运的货物");
return;
}
$("#cmdSave").attr("disabled", "disabled");
WindowLoadModel.Show();
var error = "";
$(datagrid1).each(function () {
if (this.SJOutNum != 0 && this.SJOutNum == "") {
error += this.GoodsCode + " " + this.TypeDesc + "出运数量未填;";
}
});
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.BuyCode = $("#txtBuyCode").val();
model.GoodsState = 0;
model.Remark = $("#txt_bzxx").val();
model.BuyDate = $("#txt_cyrq").val();
model.BackDate = $("#txt_yjdhrq").val();
model.PostFee = $("#txt_yfhj").val();
model.GoodsNum = $("#a_hjsl").html();
model.TSoild = $("#a_hjlf").html();
//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.StoreId = $("#select_store").val();
model.IsDelete = 0;
model.PostState = $("#select_wlzt").val();
model.IsGJ = 1;
param.model = model;
param.Goodslist = datagrid1.DataSource
var purl = "../CaiGouServiceNew.asmx/SaveChaseForHWC";
$.ajax({
url: purl,
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
WindowLoadModel.Hide();
$("#cmdSave").removeAttr("disabled");
//if (model.State == 0)
// alert("提交成功,等待审批");
//else
alert("提交成功");
//ChaseId = data.d;
window.location.href = "CG_ChaseAddForTM3.aspx?ChaseId=" + data.d;
// window.close();
// window.parent.CloseTab("新增采购", Title);
// window.location.href = "CG_Chase.aspx";
}
});
//
}
function savePostState() {
var param = new Object();
param.ChaseId = ChaseId;
param.PostState = $("#select_wlzt").val();
$.ajax({
url: "CaiGouService.asmx/SaveChasePostState",
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("保存成功");
}
});
}
function GetExcelData() {
if (ChaseId == 0) {
alert("先提交后才能导出");
return;
}
var param = new Object();
param.ChaseId = ChaseId;
var fname = "海外仓发货.xls";
WindowLoadModel.Show();
$.ajax({
url: "../CaiGouServiceNew.asmx/GetPurchaseGoodsOutExcel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
if (data.d == "") {
alert("先提交后才能导出");
return;
}
WindowLoadModel.Hide();
params = { FilePath: data.d, FileName: fname };
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
}
});
}
</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: 500px;">
<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="3">合同编号:</option>
<option value="2">采购批次号:</option>
<option value="1">货号:</option>
</select>
</td>
<td colspan="2" width="250px">
<input id="txt_code" class="editTextbox" style="width: 120px;" type="text" />
</td>
<td align="left">
</td>
<td>
<input id="Button1" type="button" value="查询" class="btnClass btnClassFind" onclick="ReadGoodsDetail();" /></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="添 加" />&nbsp;&nbsp;&nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
海运单
</div>
<table border="1" cellpadding="0" cellspacing="0" style="width: 99%;" align="center" class="tableAll">
<tr>
<td colspan="4" align="center" style="font-size: 18pt; font-weight: bolder">海运单</td>
</tr>
<tr>
<td style="width: 120px" class="f1">
批次号:
</td>
<td>
<a id="a_cgdh"></a>
</td>
<td style="width: 120px" class="f1">
出运日期:
</td>
<td>
<input id="txt_cyrq" 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" /></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">发往仓库:</td>
<td>
<select id="select_store" class="selectClass" style="width: 120px;" name="D6">
<option value="0">-选择-</option>
<option value="6">RANCHO仓</option>
<%-- <option value="9">JD仓</option>--%>
<option value="11">E仓east)</option>
</select></td>
<td style="width: 120px" class="f1">
&nbsp;</td>
<td>
&nbsp;</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"/>美元&nbsp;&nbsp; 合计:<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">备注:<br />
</td>
<td colspan="3">
<textarea id="txt_bzxx" 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>&nbsp;
<input id="cmdExcel" class="btnClass btnClassExcelTemplate"
type="button" value="导出Excel" onclick="GetExcelData();" />
<div id="dg_Goods" style="width:100%;">
</div>
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">数量合计:<a id="a_hjsl" style="font-size: x-large; color: Red"></a> &nbsp; &nbsp; &nbsp;体积合计:<a id="a_hjlf" style="font-size: x-large; color: Red"></a>立方</td>
</tr>
<tr>
<td style="width: 120px" class="f1">
出运状态:</td>
<td>
<select id="select_wlzt" class="selectClass" style="width: 120px;" name="D5">
<option value="0">未出运</option>
<option value="3">准备出运</option>
<option value="4">海上</option>
<option value="5">海外</option>
<option value="6">部分入库</option>
<option value="7">已入库</option>
</select><input id="cmdSave3" class="btnClass btnClassSave"
onclick="savePostState();" type="button" value="修改出运状态" /></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" type="button" value="提 交" class="btnClass btnClassSave" onclick="save();" />
<input id="cmdBack" type="button" value="关 闭" class="btnClass btnClassBack" />&nbsp;
<input id="cmdEnd" type="button" value="结束采购批次" class="btnClass btnClassSave" style="display:none" onclick="saveend();" />&nbsp;<input id="btn_excel" class="btnClass btnClassExcelTemplate" type="button" value="导出批次" style="display:none"/></td>
</tr>
</table>
</body>
</html>