编辑代码

click:function(o){
	var Cus=findEidV(o,"1553990683001");
	var Wh=findEid(o,"1557415790544");
	var Bin=findEid(o,"1557415791917");
	if(Cus==undefined || Cus==null || Cus=="" || Cus=="0" || Cus=="-1"){
		msg("请先选择委外商!");
		return;
	}


	//if(Wh["fullValue"]==undefined || Wh["fullValue"]==null || Wh["fullValue"]==""){
	//	msg("请先选择仓库!");
	//	return;
	//}
	//if(Bin["fullValue"]==undefined || Bin["fullValue"]==null || Bin["fullValue"]==""){
	//	msg("请先选择库位!");
	//	return;
	//}
 
	var Bredvouch=findEidV(o,"1553996108487");
	var grid=findEid(o,"1543374051797");
	var data=grid.store.data.items;
	var ids="'-1'";
	for(i in data){
		if(data[i]["data"]["SrcLineLineID"] && data[i]["data"]["SrcLineLineID"]!=null){
			ids+=",'"+data[i]["data"]["SrcLineLineID"]+"'";
		}
	};
	if(Bredvouch>0){
	var grid=findEid(o,"1543374051797");
	//Ext.create('et.view.selfrm', {"SelID":"USel_V_Doc_FormDoc0020LL",InitNull:false,"otherwhere":" and Supplier="+Cus+"and LineLineID not in("+ids+")","returnData":function(selfrm,records){
	openMenu("base_SelFrm1",{"MenuType":3,max:false,height: 600, width: 900,SelID:"USel_V_Doc_FormDoc0020LL",otherwhere:"    and Org=@Org and Supplier="+Cus+"and LineLineID not in("+ids+")",Pfrm:getPform(o),returnData:function(selfrm,records){
		var LineArr=[];
		console.log(records);
		for(i in records){
			var row1=records[i]["data"];
			var row2={};
			
			row2["SrcDocID"]=row1["DocID"];
			row2["SrcLineID"]=row1["LineID"];
			row2["SrcLineLineID"]=row1["LineLineID"];
			row2["SrcDocType|CBO_DocType"]=row1["DocType"]+"|"+row1["DocTypeCode"]+"|"+row1["来源类型"];
			row2["SrcDocNo"]=row1["单号"];
			row2["SrcLineNo"]=row1["行号"];
			row2["SrcLineLineNo"]=row1["子行号"];
			row2["Item|CBO_ItemMaster"]=row1["Item"]+"|"+row1["料号"]+"|"+row1["品名"];
			//row2["Wh|CBO_Wh"]=row1["ItemWhID"]+"|"+row1["ItemWhCode"]+"|"+row1["ItemWhName"];
			//row2["Bin|CBO_Bin"]=row1["ItemBinID"]+"|"+row1["ItemBinCode"]+"|"+row1["ItemBinName"];

			if(Wh["fullValue"]==undefined || Wh["fullValue"]==null || Wh["fullValue"]==""){
				row2["Wh|CBO_Wh"]=row1["Wh3V"];
				row2["Bin|CBO_Bin"]=row1["Bin3V"];
			}else{
				row2["Wh|CBO_Wh"]=Wh["fullValue"];
				row2["Bin|CBO_Bin"]=Bin["fullValue"];
			}

			row2["Qty"]=parseFloat(row1["未领"]);
			row2["WQty"]=parseFloat(0);

			row2["SrcLineLineID"]=row1["LineLineID"];
			row2["Operation"]=row1["委外工序"];
			row2["Note"]=row1["行备注"];
			row2["ItemCode"]=row1["收货物料编码"];
			row2["ItemName"]=row1["收货物料名称"];
			row2["ItemModel"]=row1["收货物料规格"];


			LineArr.push(row2);
		}
		AddGridLine(grid,LineArr);
		getPform(o).refData("");
		selfrm.up("window").close();
	}}).show();
     }
     if(Bredvouch<0){
	var grid=findEid(o,"1543374051797");
	//Ext.create('et.view.selfrm', {"SelID":"USel_V_Doc_FormDoc0020HH",InitNull:false,"otherwhere":" and Supplier="+Cus+"and LineLineID not in("+ids+")","returnData":function(selfrm,records){
	openMenu("base_SelFrm1",{"MenuType":3,max:false,height: 600, width: 900,SelID:"USel_V_Doc_FormDoc0020HH",otherwhere:"    and Org=@Org and Supplier="+Cus+"and LineLineID not in("+ids+")",Pfrm:getPform(o),returnData:function(selfrm,records){
		var LineArr=[];
		console.log(records);
		for(i in records){
			var row1=records[i]["data"];
			var row2={};
			
			row2["SrcDocID"]=row1["DocID"];
			row2["SrcLineID"]=row1["LineID"];
			row2["SrcLineLineID"]=row1["LineLineID"];
			row2["SrcDocType|CBO_DocType"]=row1["DocType"]+"|"+row1["DocTypeCode"]+"|"+row1["来源类型"];
			row2["SrcDocNo"]=row1["单号"];
			row2["SrcLineNo"]=row1["行号"];
			row2["SrcLineLineNo"]=row1["子行号"];
			row2["Item|CBO_ItemMaster"]=row1["Item"]+"|"+row1["料号"]+"|"+row1["品名"];
			//row2["Wh|CBO_Wh"]=row1["ItemWhID"]+"|"+row1["ItemWhCode"]+"|"+row1["ItemWhName"];
			//row2["Bin|CBO_Bin"]=row1["ItemBinID"]+"|"+row1["ItemBinCode"]+"|"+row1["ItemBinName"];
			row2["Wh|CBO_Wh"]=Wh["fullValue"];
			row2["Bin|CBO_Bin"]=Bin["fullValue"];
			row2["Qty"]=parseFloat(row1["已领"]);
			row2["SrcLineLineID"]=row1["LineLineID"];				
			LineArr.push(row2);
		}
		AddGridLine(grid,LineArr);
		getPform(o).refData("");
		selfrm.up("window").close();
	}}).show();
     }
}