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.
D7QUANTAI/DSWeb/js/jsGridWmsZXOutEdit.js

1576 lines
68 KiB
JavaScript

10 months ago
var commonGridObj_wmsin;
var comboCustomer;//货主
var comboTruck; //装卸队
var comboStorage;//仓库
var comboGoods;//品名
var comboGoodsmodel; //型号
var pressRecord
var isLoad = 0;
var pressCount = 0;
var IsChangeCus=0;
var pressRecord;
function $(id){
return document.getElementById(id);
}
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//初始化界面
function initTj(){
$("txt_outbsno").value="";
$("txt_clientbsno").value = "";
$("h_customer").value="";
comboCustomer.setText("");
$("h_truck").value = "";
comboTruck.setText("");
$("h_storage").value="";
comboStorage.setText("");
$("h_goods").value = "";
comboGoods.setComboText($("h_goods").value);
$("h_goodsmodel").value = "";
comboGoodsmodel.setText("");
$("hd_comboWMSOP").value = "";
comboWMSOP.setText("");
$("hd_comboSTOREMAN").value = "";
comboSTOREMAN.setText("");
$("h_goodspfsl").value="";
//$("txt_packnum").value="";
$("h_goodspfsl").value="";
//
createOrder();
}
function ReShowLabel_2(gridObj) {
var columnCount = gridObj.getGridObj().getColumnsNum();
var rowCount = gridObj.getGridObj().getRowsNum();
if (rowCount > 0) {
for (var i = 0; i < rowCount; i++) {
for (var j = 0; j < columnCount; j++) {
if (j == 7 ) {
var cellCurVal = gridObj.getGridObj().cellByIndex(i, j).getValue();
gridObj.getGridObj().cellByIndex(i, j).setLabel(cellCurVal);
}else if( j == 9 || j == 10 || j == 11 || j == 12){
var cellCurVal = gridObj.getGridObj().cellByIndex(i, j).getValue();
gridObj.getGridObj().cellByIndex(i, j).setValue(cellCurVal);
}
}
}
}
}
function createOrder(){
if ($("h_Mode").value.trim() == "1") {
$("Div2").style.display = "none";
$("Div3").style.display = "none";
}
else {
$("Div2").style.display = "";
$("Div3").style.display = "";
}
//
if ($("h_outgid").value != "" && $("h_outgid").value != null && $("h_addmode").value.trim() != "1" && $("h_Mode").value.trim() != "1" && $("h_Mode").value.trim() != "2") {
$("dvtable_outtj").style.display = "none";
$("dvGain").style.display = "none";
}
else {
$("dvtable_outtj").style.display = "";
$("dvGain").style.display = "";
}
// if($("h_IsFeeGain").value=="0"){
// $("dvGain").style.display="none";
// }
// else{
// $("dvGain").style.display="";
// }
// initLoading();
var kek = $("h_outgid").value;
var kdk = $("h_addmode").value.trim();
//
// if ($("h_outgid").value != "" && $("h_outgid").value != null && $("h_addmode").value.trim() != "1" && $("h_Mode").value.trim() != "1") {
// $("hdNAMES").value = "入库单号\t出库单号\t出库人\t仓库名称\t品名\t型号\t入库日期\t出库日期\t入库件数\t剩余件数\t出库件数\t本次出库\t出库应收\t出库应付\t车号\t制单人\t制单时间\t备注";
// var headerArgs_wmsin = new Array("", "入库单号", "出库单号", "出库人", "仓库名称", "品名", "型号", "入库日期", "出库日期", "入库件数", "剩余件数", "出库件数", "本次出库", "出库应收", "出库应付", "车号", "制单人", "制单时间", "备注");
// //width
// var widthArgs_wmsin = new Array("40","80","100","100","80","100","80","80","80","80","80","80","80","80","80","80","80","100","100","100");
// //column align
// var colAlignArgs_wmsin = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
// //column sort
// var colSortArgs_wmsin = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str");
// //column type
// var colTypeArgs_wmsin = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
//
// commonGridObj_wmsin = new TGridCommon("mygrid_container_wmsin","form1",headerArgs_wmsin,widthArgs_wmsin,colAlignArgs_wmsin,colSortArgs_wmsin,colTypeArgs_wmsin);
// commonGridObj_wmsin.setResponseUrl("../WMS_ZX/WmsZXOutListGridSource.aspx");
// var kj = $("h_outgid").value;
// commonGridObj_wmsin.setRequest("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=wmsoutdetaillist&wmsgid=" + $("h_bsno").value.trim() + "&wmsoutbsno=" + $("h_outgid").value);
// commonGridObj_wmsin.setSourceType("json");
// commonGridObj_wmsin.setSkin("xp");
// commonGridObj_wmsin.setImageUrl("../images/");
// commonGridObj_wmsin.initGrid();
// commonGridObj_wmsin.bind();
// } //END if($("h_outbsno").value!="" && $("h_outbsno").value!=null){
// else {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
var headerArgs_wmsin = new Array("", "仓库名称", "库位名称", "入库单号", "客户单号", "入库日期", "品名", "型号", "计费单位", "剩余件数", "出库件数", "剩余库存", "出库重量", "本次出库", "计费重量", "应收费用", "应付费用", "车号", "备注", "入库gid");
//width
var widthArgs_wmsin = new Array("30", "100", "60", "100", "100", "80", "100", "200", "60", "60", "60", "60", "60", "60", "60", "80", "80", "100", "100", "0");
//column align
var colAlignArgs_wmsin = new Array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "right", "right", "center", "center", "center");
//column sort
var colSortArgs_wmsin = new Array("na", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str");
//column type
var colTypeArgs_wmsin = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ed", "ed", "ed", "ed", "txt", "ed", "ro");
commonGridObj_wmsin = new TGridCommon("mygrid_container_wmsin","form1",headerArgs_wmsin,widthArgs_wmsin,colAlignArgs_wmsin,colSortArgs_wmsin,colTypeArgs_wmsin);
commonGridObj_wmsin.setResponseUrl("../WMS_ZX/WmsZXOutListGridSource.aspx");
//
if ($("h_Mode").value.trim() == "1") {
commonGridObj_wmsin.setRequest("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=wmsinlistedit&search=" + escape($("h_searchJson").value)+"&wmsoutgid=" + $("h_outgid").value);
}
else {
commonGridObj_wmsin.setRequest("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=wmsinlist&search=" + escape($("h_searchJson").value));
}
commonGridObj_wmsin.setSourceType("json");
commonGridObj_wmsin.setSkin("xp");
commonGridObj_wmsin.setImageUrl("../images/");
commonGridObj_wmsin.initGrid();
commonGridObj_wmsin.bind();
commonGridObj_wmsin.getGridObj().enableEditEvents(true,false,true);
commonGridObj_wmsin.getGridObj().enableKeyboardSupport(true);
commonGridObj_wmsin.getGridObj().enableMultiselect(true);
// commonGridObj_wmsin.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
// if (state==false){
// commonGridObj_wmsin.getGridObj().cellById(rId,10).setLabel(0);
// commonGridObj_wmsin.getGridObj().cellById(rId,13).setLabel(0);
// }
// totalDynamicOutNum();
// });
var txtEdit;
commonGridObj_wmsin.getGridObj().attachEvent("onEditCell", function(stage, rId, cInd, nValue, oValue) {
//初始化状态
if (stage == 0) {
txtEdit = "";
return true;
} //stage == 0
if (stage == 1) {
txtEdit = "";
for (i = 0; i < document.all.length; i++) {
if (document.all(i).tagName == "TEXTAREA") {
txtEdit = document.all(i);
txtEdit.focus();
txtEdit.select();
break;
}
}
} //stage == 1
if (stage == 2) {//编辑结束
//获取当前RowID
var selectedId = commonGridObj_wmsin.getGridObj().getSelectedRowId();
//获取当前RowIndex
var rowIndex = commonGridObj_wmsin.getGridObj().getRowIndex(selectedId);
//获取当前CellIndex(ind)
var ind = commonGridObj_wmsin.getGridObj().getSelectedCellIndex();
//触发操作事件前获取单元值
var oldVal = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, ind).getValue();
//
if (cInd == 13) {
var s3 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 6).getValue();
var cellVal6 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, cInd).getValue();
var cellVal14 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, cInd+1).getValue();
if (cellVal6 > 0 && s3.trim() != "") {
var urlVal6 = "";
if ($("h_Mode").value.trim() == "1") {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl&goodspfsl=" + cellVal14 + "&goodname=" + escape(s3) + "&val=" + newGuid();
}
else {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl2&goodspfsl=" + cellVal14 + "&goodname=" + escape(s3) + "&ingid=" + selectedId + "&goodspack=" + cellVal6 + "&val=" + newGuid();
}
var loader6 = dhtmlxAjax.getSync(urlVal6);
var sLabel = loader6.xmlDoc.responseText;
//
if (sLabel.trim() != "") {
var arrtmp = sLabel.split(","); //将各参数分离形成参数数组
var i7 = arrtmp[0].trim();
var i8 = arrtmp[1].trim();
var ls = arrtmp[2].trim();
//commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 14).setLabel(cellVal6);
if (ls.trim() != "true") {
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 13).setLabel("0.00");
//commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 14).setLabel("0.00");
alert(ls);
commonGridObj_wmsin.getGridObj().selectCell(rowIndex, cInd, true, true);
//commonGridObj_wmsin.getGridObj().editCell();
return;
}
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel(i7);
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel(i8);
// if ($("h_truck").value == "" || $("h_truck").value == null) {
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
// }
}
// else {
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 14).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
// }
// //
// totalDynamicOutNum();
}
// else {
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 14).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
// }
}
else if (cInd == 14) {
var s3 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 6).getValue();
var cellVal6 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, cInd).getValue();
var cellVal13 = commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, cInd-1).getValue();
if (cellVal6 > 0 && s3.trim() != "") {
var urlVal6 = "";
if ($("h_Mode").value.trim() == "1") {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl&goodspfsl=" + cellVal6 + "&goodname=" + escape(s3) + "&val=" + newGuid();
}
else {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl2&goodspfsl=" + cellVal6 + "&goodname=" + escape(s3) + "&ingid=" + selectedId + "&goodspack=" + cellVal13 + "&val=" + newGuid();
}
var loader6 = dhtmlxAjax.getSync(urlVal6);
var sLabel = loader6.xmlDoc.responseText;
//
if (sLabel.trim() != "") {
var arrtmp = sLabel.split(","); //将各参数分离形成参数数组
var i7 = arrtmp[0].trim();
var i8 = arrtmp[1].trim();
var ls = arrtmp[2].trim();
if (ls.trim() != "true") {
//commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 13).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 14).setLabel("0.00");
alert(ls);
commonGridObj_wmsin.getGridObj().selectCell(rowIndex, cInd, true, true);
//commonGridObj_wmsin.getGridObj().editCell();
return;
}
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel(i7);
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel(i8);
}
else {
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
if ($("h_truck").value == "" || $("h_truck").value == null) {
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
}
}
//
totalDynamicOutNum();
}
else {
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 15).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 16).setLabel("0.00");
}
}
else if (cInd == 17) {
commonGridObj_wmsin.getGridObj().cellById(rId, cInd).setValue(nValue);
}
if (oValue == null || oValue == "" || oValue == "0") {
return true;
}
return true;
} //stage == 2
}); //onEditCell end
//键盘操作事件
commonGridObj_wmsin.getGridObj().attachEvent("onKeyPress", function (code, cFlag, sFlag) {
//onKeyPress begin
//获取当前RowID
var selectedId = commonGridObj_wmsin.getGridObj().getSelectedRowId();
//获取当前RowIndex
var RowIndex = commonGridObj_wmsin.getGridObj().getRowIndex(selectedId);
//获取当前CellIndex(ind)
var ind = commonGridObj_wmsin.getGridObj().getSelectedCellIndex();
//触发操作事件前获取单元值
var oldVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
//获取编辑单元
var txtEdit;
for (i = 0; i < document.all.length; i++) {
if (document.all(i).tagName == "TEXTAREA") {
txtEdit = document.all(i);
break;
}
}
//enter 键
if (code == 14) {
if (ind == 17 || ind == 18) {
return true;
}
} //enter 键 end
//Tab键
if (code == 9) {
//code9 begin
var colCount = commonGridObj_wmsin.getGridObj().getColumnsNum();
//获取当前RowIndex
//触发操作事件前获取单元值
if (ind < colCount) {
isExchange = false;
if (ind == 13) {
var oldVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setLabel(oldVal);
//
var strgoodname = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 6).getValue();
var cellVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
var cellVal14 = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind + 1).getValue();
if (cellVal > 0 && strgoodname.trim() != "") {
var urlVal6 = "";
if ($("h_Mode").value.trim() == "1") {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl&goodspfsl=" + cellVal14 + "&goodname=" + escape(strgoodname) + "&val=" + newGuid();
}
else {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl2&goodspfsl=" + cellVal14 + "&goodname=" + escape(strgoodname) + "&ingid=" + selectedId + "&goodspack=" + cellVal + "&val=" + newGuid();
}
var loader6 = dhtmlxAjax.getSync(urlVal6);
var sLabel = loader6.xmlDoc.responseText;
//
if (sLabel.trim() != "") {
var arrtmp = sLabel.split(","); //将各参数分离形成参数数组
var i7 = arrtmp[0].trim();
var i8 = arrtmp[1].trim();
var ls = arrtmp[2].trim();
//commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 14).setLabel(cellVal);
if (ls.trim() != "true") {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 13).setLabel("0.00");
//commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 14).setLabel("0.00");
alert(ls);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
return;
}
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel(i7);
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel(i8);
// if ($("h_truck").value == "" || $("h_truck").value == null) {
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
// }
}
// else {
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 14).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
// }
}
// else {
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 14).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel("0.00");
// commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
// }
// //
// totalDynamicOutNum();
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
else if (ind == 14) {
var oldVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setLabel(oldVal);
//
var strgoodname = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 6).getValue();
var cellVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
var cellVal13 = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind - 1).getValue();
if (cellVal > 0 && strgoodname.trim() != "") {
var urlVal6 = "";
if ($("h_Mode").value.trim() == "1") {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl&goodspfsl=" + cellVal + "&goodname=" + escape(strgoodname) + "&val=" + newGuid();
}
else {
urlVal6 = "WmsZXOutListGridSource.aspx?handle=goodspfsl2&goodspfsl=" + cellVal + "&goodname=" + escape(strgoodname) + "&ingid=" + selectedId + "&goodspack=" + cellVal13 + "&val=" + newGuid();
}
var loader6 = dhtmlxAjax.getSync(urlVal6);
var sLabel = loader6.xmlDoc.responseText;
//
if (sLabel.trim() != "") {
var arrtmp = sLabel.split(","); //将各参数分离形成参数数组
var i7 = arrtmp[0].trim();
var i8 = arrtmp[1].trim();
var ls = arrtmp[2].trim();
if (ls.trim() != "true") {
//commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, 13).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 14).setLabel("0.00");
alert(ls);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
return;
}
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel(i7);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel(i8);
if ($("h_truck").value == "" || $("h_truck").value == null) {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
}
}
else {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
}
}
else {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).setLabel("0.00");
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).setLabel("0.00");
}
//
totalDynamicOutNum();
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
else if (ind == 17) {
commonGridObj_wmsin.getGridObj().editStop(true);
if (txtEdit.value != null && txtEdit.value != "") {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue(txtEdit.value);
}
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
else if (ind == 18) {
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue(oldVal);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
}
} //cdoe9 end
//向下方向键
if (code == 40) {
//code40 begin
if (ind == 13 || ind == 17 || ind == 18 || ind == 15 || ind == 16) {
var rowCount = commonGridObj_wmsin.getGridObj().getRowsNum();
commonGridObj_wmsin.getGridObj().editStop(true);
if (RowIndex != (rowCount - 1)) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex + 1, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
}
else {
return true;
}
} //code40 end
//向上箭头
if (code == 38) {
//code38 begin
if (ind == 13 || ind == 17 || ind == 18 || ind == 15 || ind == 16) {
if (RowIndex > 0) {
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex - 1, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
} else {
return true;
}
} //code38 end
//左箭头
if (code == 37) {
//code37 begin
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
if (ind == 13) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 17, true, true);
}
else if (ind == 17) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 13, true, true);
}
else {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind - 1, true, true);
}
commonGridObj_wmsin.getGridObj().editCell();
return true;
} //code37 end
//右箭头
if (code == 39) {
//code39 begin
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
if (ind == 17) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 13, true, true);
}
else if (ind == 13) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 17, true, true);
}
else {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
}
commonGridObj_wmsin.getGridObj().editCell();
return true;
} //code39 end
//键盘输入数字
if (code >= 48 && code <= 57 || code >= 96 && code <= 105 || code == 188 || code == 110 || code == 190 || code == 229) {
if (ind == 13 || ind == 14 || ind == 17 || ind == 18 || ind == 15 || ind == 16) {
return true;
}
}
if (code >= 65 && code <= 90) {//如果是输入英文字符
if (ind == 17 || ind == 18) {
return true;
}
}
//delete
if (code == 8) {
//code8 begin
if (ind == 13 || ind == 17 || ind == 18 || ind == 15 || ind == 16) {
var start = 0;
var end = 0;
if (document.selection) {
var range = document.selection.createRange();
if (range.parentElement().className == txtEdit.className) {
var range_all = document.body.createTextRange();
range_all.moveToElementText(txtEdit);
for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) {
range_all.moveStart('character', 1);
}
for (var i = 0; i <= start; i++) {
if (txtEdit.value.charAt(i) == '\n')
start++;
}
var range_all = document.body.createTextRange();
range_all.moveToElementText(txtEdit);
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++)
range_all.moveStart('character', 1);
for (var i = 0; i <= end; i++) {
if (txtEdit.value.charAt(i) == '\n')
end++;
}
}
}
//未选中多个字符
if (start == end) {
if (start != 0) {
if (pressRecord != null) {
var firstVal = pressRecord.substring(0, start - 1);
var endVal = pressRecord.substring(start + 1, txtEdit.value.length - 1);
pressRecord = firstVal;
}
}
}
//选中多个字符
if (start != end) {
if (pressRecord != null) {
var firstVal = pressRecord.substring(0, start);
var endVal = pressRecord.substring(end - 1, txtEdit.value.length - 1);
pressRecord = firstVal + endVal;
}
}
setTimeout(function () {
if (pressRecord != null) {
if (pressRecord.trim().length > 0) {
var combo = commonGridObj_wmsin.getGridObj().getCustomCombo(selectedId, ind);
var comboArg = combo.getKeys();
var count = 0;
for (var i = 0; i < comboArg.length; i++) {
if (combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0) {
count++;
var oldVal = comboArg[i];
var oldLab = combo.get(comboArg[i]);
pressCount = 3;
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, ind).setValue(oldVal);
commonGridObj_wmsin.getGridObj().selectCell(rowIndex, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
var old_length = oldLab.length;
for (i = 0; i < document.all.length; i++) {
if (document.all(i).tagName == "TEXTAREA") {
txtEdit = document.all(i);
var rt = txtEdit.createTextRange();
rt.collapse();
rt.select(); //光标置最前
var r = document.selection.createRange();
r.collapse(false);
r.moveStart("character", pressRecord.length); //从m位开始
r.moveEnd("character", old_length); //选取n位
//txtEdit.focus();
r.select();
}
}
break;
}
}
}
}
}, 500);
return true;
} else {
return true;
}
} //code8 end
if (code == 46) {
if (ind == 13) {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setLabel("");
}
else if (ind == 17 || ind == 18) {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue("");
}
} //end code == 46
});
//}
isLoad = 1;
} // createOrder() end
function outputMoney(number) {
number= number.replace(/\,/g,"");
if (isNaN(number)||number=="") return "";
number = Math.round( number*100) /100;
if(number<0)
return '-'+outputDollars(Math.floor(Math.abs(number)-0) + '') + outputCents(Math.abs(number) - 0);
else
return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0);
}
function RecreateOrder(){
createOrder();
} //RecreateOrder() end
var newGuid = function(){
var guid = "";
for (var i = 1; i <= 32; i++){
var n = Math.floor(Math.random()*16.0).toString(16);
guid += n;
if((i==9)||(i==14)||(i==16)||(i==20))
guid += "-";
}
return guid.toUpperCase();
};
function doCheck(clickObj){
// alert($(clickObj).checked);
//// if($(clickObj).checked){
// $(clickObj).checked = 0;
// return ;
// }else{
// $(clickObj).checked = 1;
// return ;
// }
}
//初始化Combo
function initCombos()
{
if($("sel_customer")!=null){
initComboCustomer();//货主
}
if ($("sel_truck") != null) {
initComboTruck(); //装卸队
}
if($("sel_storage")!=null){
initComboStorage();//仓库名称
}
initcomboGoods2(); //品名ok
initcomboGoodsmodel(); //型号ok
initComboWMSOP2();
initComboSTOREMAN2();
// finishLoading();
}
function initComboCustomer(){//货主
comboCustomer = new TCombo("sel_customer", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCONTROLLER", true, true, false, true, "h_customer");
comboCustomer.initComboEvent();
comboCustomer.bind();
if($("h_customer").value!="" && $("h_customer").value!=null)
{
comboCustomer.setText($("h_customer").value);
}
// if ($("h_Mode").value == "1" && $("h_Mode").value == "2") {
// comboCustomer.disable(true);
// }
// else {
// comboCustomer.disable(false);
// }
}
function initComboTruck() {//装卸队
comboTruck = new TCombo("sel_truck", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISTRUCK", true, true, false, true, "h_truck");
comboTruck.initComboEvent();
comboTruck.bind();
if ($("h_truck").value != "" && $("h_truck").value != null)
{
comboTruck.setText($("h_truck").value);
}
// if ($("h_Mode").value == "1" && $("h_Mode").value == "2") {
// comboTruck.disable(true);
// }
// else {
// comboTruck.disable(false);
// }
}
//storage
function initComboStorage() {//仓库名称
comboStorage = new TCombo("sel_storage", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISWAREHOUSE", true, true, false, true, "h_storage");
comboStorage.initComboEvent();
comboStorage.bind();
if($("h_storage").value!="" && $("h_storage").value!=null)
{
comboStorage.setText($("h_storage").value);
}
}
//function initcomboGoods(){//品名ok
// comboGoods = new TCombo("sel_goods", "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodslist", true, true, false, true, "h_goods");
// comboGoods.initComboEvent();
// comboGoods.bind();
// if($("h_goods").value!="" && $("h_goods").value!=null)
// {
// comboGoods.setText($("h_goods").value);
// }
//}
//function initcomboGoodsmodel() {//型号ok
// comboGoodsmodel = new TCombo("sel_goodsmodel", "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodsmodel&strgoods=" + $("h_goods").value, true, true, false, true, "h_goodsmodel");
// comboGoodsmodel.initComboEvent();
// comboGoodsmodel.bind();
// if ($("h_goodsmodel").value != "" && $("h_goodsmodel").value != null)
// {
// comboGoodsmodel.setText($("h_goodsmodel").value);
// }
//}
function initcomboGoods()//品名
{
comboGoods = dhtmlXComboFromSelect("sel_goods");
comboGoods.loadXML("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodslist");
//
comboGoodsmodel = dhtmlXComboFromSelect("sel_goodsmodel");
comboGoodsmodel.loadXML("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodsmodel&strgoods=");
}
function initcomboGoods2()//品名
{
// if ($("h_Mode").value == "1" || $("h_Mode").value == "2") {
// comboGoods.disable(true);
// }
//
comboGoods.attachEvent("onChange", function() {
comboGoods.setComboText($("h_goods").value);
});
comboGoods.attachEvent("onBlur", function() {
var s1 = comboGoods.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("h_goods").value = "";
comboGoods.setComboText($("h_goods").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboGoods.setComboText(s3);
$("h_goods").value = s3;
}
else {
comboGoods.setComboText($("h_goods").value);
}
}
//
initcomboGoodsmodel();
});
//
comboGoods.setOptionWidth(200);
comboGoods.setComboText($("h_goods").value);
comboGoods.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("h_goods").value.trim();
if ("" != comboGoods.getComboText().trim()) {
while ("undefined" != typeof comboGoods.getOptionByIndex(filterCount)) {
var comboValue = comboGoods.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboGoods.getComboText().trim().toUpperCase();
$("h_goods").value = comboGoods.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboGoods.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("h_goods").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboGoods.attachEvent("onSelectionChange", function() {
$("h_goods").value = comboGoods.getComboText().trim();
});
}
function initcomboGoodsmodel()//型号
{
comboGoodsmodel.loadXML("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodsmodel&strgoods=" + escape($("h_goods").value));
comboGoodsmodel.setComboText($("h_goodsmodel").value);
//
// if ($("h_Mode").value == "1" || $("h_Mode").value == "2") {
// comboGoodsmodel.disable(true);
// }
//
comboGoodsmodel.attachEvent("onChange", function() {
comboGoodsmodel.setComboText($("h_goodsmodel").value);
});
comboGoodsmodel.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
if ("" != comboGoodsmodel.getComboText().trim()) {
while ("undefined" != typeof comboGoodsmodel.getOptionByIndex(filterCount)) {
var comboValue = comboGoodsmodel.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboGoodsmodel.getComboText().trim().toUpperCase();
$("h_goodsmodel").value = comboGoodsmodel.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboGoodsmodel.selectOption(filterCount, true, true);
break;
}
++filterCount;
}
}
}, 10);
}
});
comboGoodsmodel.attachEvent("onSelectionChange", function() {
$("h_goodsmodel").value = comboGoodsmodel.getComboText().trim();
});
}
function initComboWMSOP()//操作人员
{
//生成
var strUserID = $("hdUserID").value;
comboWMSOP = dhtmlXComboFromSelect("ddlWMSOP");
comboWMSOP.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isOperator&userID=" + strUserID);
}
function initComboWMSOP2()//操作人员
{
if ($("h_Mode").value == "1" || $("h_Mode").value == "2") {
comboWMSOP.disable(true);
}
comboWMSOP.attachEvent("onChange", function() {
comboWMSOP.setComboText($("hd_comboWMSOP").value);
});
comboWMSOP.attachEvent("onBlur", function() {
var s1 = comboWMSOP.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboWMSOP").value = "";
comboWMSOP.setComboText($("hd_comboWMSOP").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboWMSOP.setComboText(s3);
$("hd_comboWMSOP").value = s3;
}
else {
comboWMSOP.setComboText($("hd_comboWMSOP").value);
}
}
});
comboWMSOP.setComboText($("hd_comboWMSOP").value);
comboWMSOP.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboWMSOP").value.trim();
if ("" != comboWMSOP.getComboText().trim()) {
while ("undefined" != typeof comboWMSOP.getOptionByIndex(filterCount)) {
var comboValue = comboWMSOP.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboWMSOP.getComboText().trim().toUpperCase();
$("hd_comboWMSOP").value = comboWMSOP.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboWMSOP.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboWMSOP").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboWMSOP.attachEvent("onSelectionChange", function() {
$("hd_comboWMSOP").value = comboWMSOP.getComboText().trim();
});
}
function initComboSTOREMAN()//操作人员
{
//生成
var strUserID = $("hdUserID").value;
comboSTOREMAN = dhtmlXComboFromSelect("ddlSTOREMAN");
comboSTOREMAN.loadXML("../FeeCodes/OPAdapter.aspx?mask=0&pos=0&rName=isOperator&userID=" + strUserID);
}
function initComboSTOREMAN2()//操作人员
{
if ($("h_Mode").value == "1" || $("h_Mode").value == "2") {
comboSTOREMAN.disable(true);
}
comboSTOREMAN.attachEvent("onChange", function() {
comboSTOREMAN.setComboText($("hd_comboSTOREMAN").value);
});
comboSTOREMAN.attachEvent("onBlur", function() {
var s1 = comboSTOREMAN.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboSTOREMAN").value = "";
comboSTOREMAN.setComboText($("hd_comboSTOREMAN").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboSTOREMAN.setComboText(s3);
$("hd_comboSTOREMAN").value = s3;
}
else {
comboSTOREMAN.setComboText($("hd_comboSTOREMAN").value);
}
}
});
comboSTOREMAN.setComboText($("hd_comboSTOREMAN").value);
comboSTOREMAN.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSTOREMAN").value.trim();
if ("" != comboSTOREMAN.getComboText().trim()) {
while ("undefined" != typeof comboSTOREMAN.getOptionByIndex(filterCount)) {
var comboValue = comboSTOREMAN.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboSTOREMAN.getComboText().trim().toUpperCase();
$("hd_comboSTOREMAN").value = comboSTOREMAN.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboSTOREMAN.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboSTOREMAN").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboSTOREMAN.attachEvent("onSelectionChange", function() {
$("hd_comboSTOREMAN").value = comboSTOREMAN.getComboText().trim();
});
}
function outputDollars(number)
{
if (number.length<= 3)
return (number == '' ? '0' : number);
else
{
var mod = number.length%3;
var output = (mod == 0 ? '' : (number.substring(0,mod)));
for (i=0 ; i< Math.floor(number.length/3) ; i++)
{
if ((mod ==0) && (i ==0))
output+= number.substring(mod+3*i,mod+3*i+3);
else
output+= ',' + number.substring(mod+3*i,mod+3*i+3);
}
return (output);
}
}
function outputCents(amount)
{
amount = Math.round( ( (amount) - Math.floor(amount) ) *100);
return (amount<10 ? '.0' + amount : '.' + amount);
}
function postEnterFee(){
var myForm = document.getElementById("form1");
myForm.submit() ;
}
function ConvertToMoney(strObj){
var result = strObj.replace(",","");
return result;
}
function clearNoNum(valObj)
{
//先把非数字的都替换掉,除了数字和.
valObj = valObj.replace(/[^\d.]/g,"");
//必须保证第一个为数字而不是.
valObj = valObj.replace(/^\./g,"");
//保证只有出现一个.而没有多个.
valObj = valObj.replace(/\.{2,}/g,".");
//保证.只出现一次,而不能出现两次以上
valObj = valObj.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
if(valObj.indexOf(".") == valObj.length-1){
valObj += "0";
}
return valObj;
}
function isObjNaN(Obj){
if(Obj.toString().toLowerCase() == "nan"){
return 0;
}else{
return Obj;
}
}
function search(){//查询入库wms_in信息
//var wmsgid=$("hd_wmsgid").value;
var cus = $("h_customer").value;
if (cus == "") {
alert("货主名称不能为空!");
return;
}
var blno = $("txt_bsno").value;
//var txtclientbsno = $("txt_clientbsno").value;
var store = $("h_storage").value;
if(blno!=null && blno!=""){
$("h_blno").value=blno;
}
var searchJson = "";
searchJson +="{";
searchJson += "[";
//searchJson += "\"wmsgid\":\""+wmsgid+"\",";
searchJson += "\"cus\":\""+cus+"\",";
searchJson += "\"blno\":\""+blno+"\",";
//searchJson += "\"clientbsno\":\"" + txtclientbsno + "\",";
searchJson += "\"store\":\"" + store + "\",";
searchJson += "\"goods\":\"" + $("h_goods").value + "\",";
searchJson += "\"goodsmodel\":\"" + $("h_goodsmodel").value + "\",";
searchJson += "\"wmsop\":\"" + $("hd_comboWMSOP").value + "\",";
searchJson += "\"storeman\":\"" + $("hd_comboSTOREMAN").value + "\",";
searchJson += "\"remark\":\"" + $("txt_remark").value + "\"";
searchJson += "]";
searchJson +="}";
$("h_searchJson").value = searchJson;
// createOrder();
RecreateOrder();
}
function ShowShifting(selectedId) {
alert('操作成功');
window.parent.opener.location.href = window.parent.opener.location.href;
window.close();
var URLs = "../WMS_ZX/WmsZXInfo.aspx?handle=edit&id=" + selectedId + "&val=" + newGuid();
//
var urlVal = "../WMS_ZX/WmsListGridSource.aspx?handle=getislock&gids=" + selectedId + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
URLs = "../WMS_ZX/WmsZXInfo.aspx?handle=edit&isenabled=false&id=" + selectedId + "&val=" + newGuid();
}
//
window.open(URLs, "_blank", "height=520px, width=1000px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no,Top= " + (screen.height / 2 - 200) + ",Left= " + (screen.width / 2 - 400));
}
function setShifting() {//库间移位
if (window.confirm("您确定要做库间移位吗?")) {
$("hdShifting").value = "1";
OutStorage();
}
}
function OutStorage() {//生成出库单
//totalDynamicOutNum();
if ($("h_outbsno").value != "" && $("h_outbsno").value != null && $("h_Mode").value.trim() != "1" && $("h_Mode").value.trim() != "2")
{
alert("出库单已经生成!");
return;
}
var cust = $("h_customer").value;
if (cust == "") {
alert("货主名称不能为空!");
return;
}
var truck = $("h_truck").value;
// if (truck == "") {
// alert("装卸队名称不能为空!");
// return;
// }
var outdate = $("txt_outdate").value;
if (outdate == "") {
alert("出库日期不能为空!");
return;
}
// var istr = IsNum($("h_packnum").value);
// if (!istr) {
// alert("出库件数格式有误或不能为“0”");
// return;
// }
// else {
// outpacknum = parseFloat($("h_packnum").value);
// }
outpacknum = parseFloat($("h_packnum").value);
// outpacknum = parseInt($("h_packnum").value);
// if (outpacknum == "") {
// alert("出库件数不能为零!");
// return;
// }
//保存后录入的数据
var truck;
var id;
if ($("WoDetailContainer").value.trim() == "addwmsout") {
for (var i = 0; i < commonGridObj_wmsin.getGridObj().getRowsNum(); i++) {
var Num_Out = commonGridObj_wmsin.getGridObj().cellByIndex(i, 13).getValue();
var Num_Out2 = commonGridObj_wmsin.getGridObj().cellByIndex(i, 14).getValue();
if (Num_Out != 0) {
var Num_Kc = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i, 9).getValue()));
if (Num_Out > Num_Kc) {
commonGridObj_wmsin.getGridObj().cellByIndex(i, 13).setLabel(Num_Kc);
}
//
var Num_Kc2 = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i, 10).getValue()));
if (Num_Out2 > Num_Kc2) {
commonGridObj_wmsin.getGridObj().cellByIndex(i, 14).setLabel(Num_Kc2);
}
//
id = commonGridObj_wmsin.getGridObj().getRowId(i);
totalDynamicOutNum();
}
truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i, 17).getValue();
}
}
var WoState=0;
WoState=saveWoChange();
var WoDetailState=0;
WoDetailState=saveWoDetailChange();
if($("WoContainer").value.trim() == "" || $("WoDetailContainer").value.trim() == ""){
return;
}
if (WoState==1 && WoDetailState==1){
msgBox();
//定时发送数据
setTimeout(postEnterFee, 200);
//
if ($("h_Mode").value.trim() == "1") {
$("h_post").value = 3;
}
else if ($("h_Mode").value.trim() == "2") {
$("h_post").value = 4;
}
else {
$("h_post").value = 2;
}
}
}
function saveWoChange(){
var jsonFeeObj = null;
var cust = $("h_customer").value;
var truck = $("h_truck").value;
var outdate=$("txt_outdate").value;
var goodspfsl = parseFloat($("h_goodspfsl").value);
outpacknum = parseFloat($("h_packnum").value);
var remark = $("txt_remark").value;
var txtoutbsno = $("txt_outbsno").value;
var txtclientbsno = $("txt_clientbsno").value;
var truckno="";
for(var i=0;i<commonGridObj_wmsin.getGridObj().getRowsNum();i++){
var outnumdetail=clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i,13).getValue())));
if(outnumdetail>0){
truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i,17).getValue();
}
}
//
if (truckno.trim() != "") {
while (truckno.indexOf(" ") > 0) {
truckno = truckno.replace(" ", "");
}
while (truckno.indexOf("\r\n") > 0) {
truckno = truckno.replace("\r\n", "");
}
}
//
var cacheBuffer = "";
cacheBuffer += "{";
cacheBuffer += "\"txtoutbsno\":\"" + txtoutbsno + "\",";
cacheBuffer += "\"txtclientbsno\":\"" + txtclientbsno + "\",";
cacheBuffer += "\"cust\":\""+cust+"\",";
cacheBuffer += "\"truck\":\"" + truck + "\",";
cacheBuffer += "\"outdate\":\""+outdate+"\",";
//cacheBuffer += "\"goodsname\":\""+goodsname+"\",";
//cacheBuffer += "\"goodsmodel\":\"" + goodsmodel + "\",";
cacheBuffer += "\"outpacknum\":\"" + outpacknum + "\",";
cacheBuffer += "\"goodspfsl\":\"" + goodspfsl + "\",";
cacheBuffer += "\"truckno\":\"" + truckno + "\",";
cacheBuffer += "\"remark\":\""+remark+"\"";
cacheBuffer += "}";
var result = "";
result += "{\"fees\":[";
result += cacheBuffer;
result += "]}";
jsonFeeObj = eval('(' + result + ')');
$("WoContainer").value=JSON.stringify(jsonFeeObj);
return 1;
}
function saveWoDetailChange(){
var jsonFeeObj = null;
for(var i=0;i<commonGridObj_wmsin.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_wmsin.getGridObj().getRowId(i);
var inbsno = rowId; //wms_in.bsno
var RowIndex = commonGridObj_wmsin.getGridObj().getRowIndex(rowId);
var cust=$("h_customer").value;
if ($("h_Mode").value.trim() == "1") {
inbsno = commonGridObj_wmsin.getGridObj().cellByIndex(i, 19).getValue();
}
var indate=commonGridObj_wmsin.getGridObj().cellByIndex(i,5).getValue();
var goodsname = commonGridObj_wmsin.getGridObj().cellByIndex(i,6).getValue();
var goodsmodel = commonGridObj_wmsin.getGridObj().cellByIndex(i, 7).getValue();
var fsdf = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 13).getValue();
var outpacknum = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 13).getValue())));
var arfee = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 15).getValue())))
var apfee = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 16).getValue()))); ;
var truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i, 17).getValue();
var remark = commonGridObj_wmsin.getGridObj().cellByIndex(i,18).getValue();
var checkState = commonGridObj_wmsin.getGridObj().cellByIndex(i,0).getValue();
var storage = commonGridObj_wmsin.getGridObj().cellByIndex(i, 1).getValue();
var areaname = commonGridObj_wmsin.getGridObj().cellByIndex(i, 2).getValue();
var goodspfsl = commonGridObj_wmsin.getGridObj().cellByIndex(i, 14).getValue();
var chargeunit = commonGridObj_wmsin.getGridObj().cellByIndex(i, 8).getValue();
if (outpacknum > 0 && goodspfsl > 0) {
//if(checkState==1){
if(jsonFeeObj == null){
var cacheBuffer = "";
cacheBuffer += "{";
cacheBuffer += "\"cust\":\""+cust+"\",";
cacheBuffer += "\"inbsno\":\""+inbsno+"\",";
cacheBuffer += "\"indate\":\""+indate+"\",";
cacheBuffer += "\"goodsname\":\""+goodsname+"\",";
cacheBuffer += "\"goodsmodel\":\"" + goodsmodel + "\",";
//
if (truckno.trim() != "") {
while (truckno.indexOf(" ") > 0) {
truckno = truckno.replace(" ", "");
}
while (truckno.indexOf("\r\n") > 0) {
truckno = truckno.replace("\r\n", "");
}
}
//
cacheBuffer += "\"truckno\":\""+truckno+"\",";
cacheBuffer += "\"outpacknum\":\"" + outpacknum + "\",";
cacheBuffer += "\"goodspfsl\":\"" + goodspfsl + "\",";
cacheBuffer += "\"arfee\":\"" + arfee + "\",";
cacheBuffer += "\"apfee\":\"" + apfee + "\",";
cacheBuffer += "\"remark\":\"" + remark + "\",";
cacheBuffer += "\"gid\":\"" + rowId + "\",";
cacheBuffer += "\"areaname\":\"" + areaname + "\",";
cacheBuffer += "\"storage\":\"" + storage + "\",";
cacheBuffer += "\"chargeunit\":\"" + chargeunit + "\"";
cacheBuffer += "}";
var result = "";
result += "{\"fees\":[";
result += cacheBuffer;
result += "]}";
jsonFeeObj = eval('(' + result + ')');
}else{
var newFeeRow = jsonFeeObj.fees;
newFeeRow = {cust:cust,inbsno:inbsno,indate:indate,goodsname:goodsname,goodsmodel:goodsmodel,
truckno: truckno, outpacknum: outpacknum, goodspfsl: goodspfsl, arfee: arfee, apfee: apfee, remark: remark, gid: rowId, areaname: areaname, storage: storage, chargeunit: chargeunit
};
jsonFeeObj.fees.push(newFeeRow);
}
}
}
if(jsonFeeObj!=null)
{
$("WoDetailContainer").value=JSON.stringify(jsonFeeObj);
return 1;
}
else
{
$("WoDetailContainer").value="";
alert("请输入本次出库的件数和重量!");
return 0;
}
}
//信息提示
function msgBox(){
var dg=new dialog();
dg.html="正在保存中,请稍等……";//"<input type=button onclick='new dialog().close();' value='确定'>";
dg.width=200;
dg.height=100;
dg.title="";
dg.show();
}
//对话框
function dialog()
{
// alert("打开dialog");
this.width=450;
this.height=360;
this.title_height=20;
this.html='';
this.title='';
var self = this;
var bgObj,msgObj,titleObj;
this.close=function()
{
document.body.removeChild(document.getElementById("bgDiv"));
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
document.body.removeChild(document.getElementById("msgDiv"));
}
this.show=function()
{
var msgw,msgh,bordercolor;
msgw=self.width;
msgh=self.height;
bordercolor="#336699";
titlecolor="#99CCFF";
var sWidth,sHeight;
sWidth=document.body.offsetWidth;
sHeight=screen.height;
bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#777";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.background="white";
msgObj.style.border="1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "30%";
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight ="25px";
msgObj.style.zIndex = "10001";
titleObj=document.createElement("h4");
titleObj.setAttribute("id","msgTitle");
titleObj.setAttribute("align","center");
titleObj.style.margin="0";
titleObj.style.padding="3px";
titleObj.style.background=bordercolor;
titleObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
titleObj.style.opacity="0.75";
titleObj.style.border="1px solid " + bordercolor;
titleObj.style.height=self.title_height+"px";
titleObj.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
titleObj.style.color="white";
titleObj.style.cursor="pointer";
titleObj.innerHTML=self.title;
//titleObj.onclick=function(){self.close();}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(titleObj);
var txt=document.createElement("div");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
txt.innerHTML=self.html;
document.getElementById("msgDiv").appendChild(txt);
}
}
function fomatFloat(src,pos){
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}
function initLoading(){
$("progressBar").style.display = "";
}
function finishLoading(){
$("progressBar").style.display = "none";
}
//动态计算本次出库重量信息
function totalDynamicOutNum(){
//获取出库列表行数
var rowCount_WmsOut = commonGridObj_wmsin.getGridObj().getRowsNum();
var amountpack = 0.00; //件数合计
var rownum=0.00;//本次出库件数
var amountpack2 = 0.00; //件数合计
var rownum2 = 0.00; //本次出库件数
//计算应收费用
for(var i = 0;i<rowCount_WmsOut;i++){
rownum = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i,13).getValue()));
rownum2 = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i, 14).getValue()));
if(rownum.toString().toLowerCase() == "nan"){
rownum = 0;
}
if(rownum2.toString().toLowerCase() == "nan"){
rownum2 = 0.00;
}
if(rownum>0){
amountpack = amountpack+rownum;
}
if(rownum2>0){
amountpack2 = amountpack2+rownum2;
}
}
$("h_packnum").value = outputMoney(amountpack.toString());
$("h_goodspfsl").value = outputMoney(amountpack2.toString());
}
function AddWmsOut() { //添加出库单
$("h_Mode").value= "2"
//$("h_outbsno").value="";
$("h_IsFeeGain").value="1";
$("btn_Out").InnerHtml = "生成出库单";
//$("h_wmsoutbsno").Value = "";
//$("txt_outdate").value="";
//$("txt_outbsno").value="";
//$("h_outgid").value = "";
$("h_addmode").value="1";
initCombos();
createOrder();
//initGrid();
//initDownFeeName();
//initMenu();
//initTj();
}
function DeleteWmsOut(){ //删除出库单
if ($("h_outgid").value == "") {
return;
}
if(window.confirm("您确定要删除当前出库单(包含明细)?")){
var url = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=deletewmsout&wmsoutgid="+$("h_outgid").value;
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if(deleteState == 1){
alert("成功删除出库单");
window.opener.location.reload();
window.close();
//AddWmsOut();
}
else{
alert("删除出库单,失败!");
}
}
}
function printAction() {
var strBSNO = "";
strBSNO = $("h_outgid").value;
var printUrl = "";
var companyID = "";
var typeName = "WmszxoutInfoReport";
var dbSourceID = "";
var userID = "";
var url = "../Reports/ReportService.aspx?handle=printwmszxoutinfo&bsno=" + strBSNO + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(url);
var reportVal = loader.xmlDoc.responseText;
var reportObj = null;
if (reportVal != "") {
reportObj = eval('(' + reportVal + ')');
if (reportObj.reports.length > 0) {
if (reportObj.reports[0].compid != "") {
companyID = reportObj.reports[0].compid;
}
if (reportObj.reports[0].sourceid != "") {
dbSourceID = reportObj.reports[0].sourceid;
}
if (reportObj.reports[0].compid != "") {
userID = reportObj.reports[0].userid;
}
printUrl = "print://?comp=" + companyID + "&type=" + typeName + "&dbid=" + dbSourceID + "&uid=" + userID; //alert(printUrl);
window.location.href = window.location.href;
location.href = printUrl;
}
} else {
alert("没有要打印的报表");
return;
}
}
//是否为数字
function IsNum(val) {
var re = /^[-\+]?\d+(\.\d+)?$/;
if (!re.test(val)) {
return false;
} else {
return true;
}
}