条件选择:function(oo,cls,v){
var o=oo.up("SellistTab");
if(oo.xtype=="SellistTab"){o=oo;}
if(o && o["Run"]==true){return;}
o["Run"]=true;
var grid=o.down("xDgrid");
var caigouyuan_=findEid(o,"采购员");
var Company_=findEid(o,"工厂");
var CreateNo_=findEid(o,"生单批次");
var lei1_=findEid(o,"大类");
var lei2_=findEid(o,"小类");
var gys_=findEid(o,"供应商");
var memo_=findEid(o,"客户PO");
var qgDate1=findEidV(o,"请购日期1");
var qgDate2=findEidV(o,"请购日期2");
var qgDocNo=findEidV(o,"请购单号");
var hebintianshu=findEidV(o,"hebintianshu");
var ItemName=findEidV(o,"品名");
var AddNotBuy=findEid(o,"含暂不采购");
if(qgDate1==null){qgDate1=new Date("2000-01-01");}
if(qgDate2==null){qgDate2=new Date("2099-12-31");}
if(AddNotBuy==null){AddNotBuy=false;}
var Str=cls+"~"+v+"~"+caigouyuan_.getItemsV()+"~"+Company_.getItemsV()+"~"+CreateNo_.getValue()+"~"+lei1_.getItemsV()+"~"+lei2_.getItemsV()+"~"+gys_.getValue()+"~"+memo_.getValue()+"~"+qgDate1.Format("yyyy-MM-dd")+"~"+qgDate2.Format("yyyy-MM-dd")+"~"+qgDocNo+"~"+ItemName+"~"+AddNotBuy.getItemsV()+"~"+hebintianshu;
console.log(Str);
var Sql="exec p_PM_All '选择',@Org,'"+Str+"',@User,@UserName";
var carry= JSON.parse(GetHtmlTB({Lei:"execSql2",Sql:Sql}));
console.log(carry);
for(n in carry[0]){
var i=carry[0][n]["i"];
var Eid=carry[0][n]["Eid"];
var v=carry[0][n]["v"];
if(Eid=="表格"){
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(Eid=="生单批次") {
findEid(o,Eid).setValue(v);
} else if(cls=="条件查询集合") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="已选集合") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="未选集合") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="暂不采购") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="请购日期1") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="请购日期2") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="请购单号") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="批量更改") {
WriteLinesForID(grid,carry[0]);
} else if(cls=="含暂不采购") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="品名") {
grid.Sql=carry[i][0]["Sql"];
grid.store.reload();
} else if(cls=="合并处理") {
grid.store.reload();
} else {
findEid(o,Eid).SetItems(carry[i],v);
}
}
o["Run"]=false;
return;
}
,表头按钮:[
{"type":"复选框","Eid":"采购员选择","类型":"布尔","名称":"采购员选择","宽":"80","边白":"5 0 0 0","标签":"采购员","标签宽":55,值:true},
{"标签":"","绑定":"","类型":"文本","type":"文本框","Eid":"采购员值","名称":"采购员值","宽":120,"边白":"5 0 0 0","标签位置":"right","标签宽":1,"值":""},
{"type":"复选框","Eid":"采购交期选择","类型":"布尔","名称":"采购交期","宽":"90","边白":"5 0 0 0","标签":"采购交期","标签宽":65,值:true},
{"type":"日期框","Eid":"采购日期值","名称":"采购日期值","标签":"","绑定":"","类型":"日期","显示":true,"宽":120,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":55,"格式":"Y-m-d","值":""},
{"type":"复选框","Eid":"采购数量选择","类型":"布尔","名称":"采购数量","宽":"90","边白":"5 0 0 0","标签":"采购数量","标签宽":65,值:true},
{"type":"数字框","Eid":"采购数量值","名称":"采购数量值","小数位":0,"标签":"","绑定":"","类型":"数值","显示":true,"宽":120,"占比":-1,"边白":"0 0 0 0","标签位置":"right","标签宽":55,"值":"0"},
{"type":"复选框","Eid":"供应商选择","类型":"布尔","名称":"供应商","宽":"80","边白":"5 0 0 0","标签":"供应商","标签宽":55,值:true},
{"实体":"CBO_Supplier,供应商","标签":"","绑定":"","类型":"实体","type":"参照框","Eid":"供应商值","名称":"供应商值","宽":120,"边白":"5 0 0 0","标签位置":"right","标签宽":1,"值":""},
{text: '批量更改',handler:function(o){
var grid=o.up("SellistTab").down("xDgrid");
var data=getGridDate(grid);
var bcd=[];
console.log(data);
var PoDt=findEidV(o.up("SellistTab"),"采购交期选择");
var Qty=findEidV(o.up("SellistTab"),"采购数量选择");
var Sup=findEidV(o.up("SellistTab"),"供应商选择");
var cgy=findEidV(o.up("SellistTab"),"采购员选择");
var dt=findEidV(o.up("SellistTab"),"采购日期值");
if(dt){
dt=dt.Format("yyyy-MM-dd");
}
bcd.push(PoDt);
bcd.push(dt);
bcd.push(Qty);
bcd.push(findEidV(o.up("SellistTab"),"采购数量值"));
bcd.push(Sup);
bcd.push(findEidV(o.up("SellistTab"),"供应商值"));
bcd.push(cgy);
bcd.push(findEidV(o.up("SellistTab"),"采购员值"));
for(i in data){
var row=data[i].data;
if(row["ID"]!="" && row["选择"]=="√"){
bcd.push(row["ID"]);
}
}
o.up("SellistTab").OtherInfo["条件选择"](o,"批量更改",JSON.stringify(bcd));
}}
]
,其它表头栏:[[
{"type":"平面容器","Eid":"采购员","名称":"采购员","宽":"135","高":25,"子件布局":"左右","边框":false,"边白":"0 0 0 0","集合类型":"单下拉框","集合子项":"aa,bb","集合值":"","集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;","子项标签宽":45,集合选择:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"采购员",newValue);}}},
{"type":"平面容器","Eid":"工厂","名称":"工厂","宽":"160","高":25,"子件布局":"左右","边框":false,"边白":"0 0 0 0","集合类型":"单下拉框","集合子项":"","集合值":"","集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;","子项标签宽":30,集合选择:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"工厂",newValue);}}},
{"type":"平面容器","Eid":"大类","名称":"大类","宽":"110","高":25,"子件布局":"左右","边框":false,"边白":"0 0 0 0","集合类型":"单下拉框","集合子项":"","集合值":"","集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;","子项标签宽":30,集合选择:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"大类",newValue);}}},
{"type":"平面容器","Eid":"小类","名称":"小类","宽":"110","高":25,"子件布局":"左右","边框":false,"边白":"0 0 0 0","集合类型":"单下拉框","集合子项":"","集合值":"","集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;","子项标签宽":30,集合选择:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"小类",newValue);}}},
{"type":"文本框","Eid":"生单批次","名称":"生单批次","标签":"生单批次","绑定":"生单批次","类型":"文本","显示":true,"宽":180,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":55,"值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"生单批次",newValue);}}}},
{"type":"文本框","Eid":"供应商","名称":"供应商","标签":"供应商","绑定":"供应商","类型":"文本","显示":true,"宽":200,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":45,"值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"供应商",newValue);}}}},
{"type":"文本框","Eid":"客户PO","名称":"客户PO","标签":"客户PO","绑定":"客户PO","类型":"文本","显示":true,"宽":200,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":45,"值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"客户PO",newValue);}}}}
],[
{"type":"日期框","Eid":"请购日期1","名称":"请购日期","标签":"请购日期","绑定":"请购日期","类型":"日期","显示":true,"宽":167,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":60,"格式":"Y-m-d","值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"请购日期1",newValue);}}}},
{"type":"日期框","Eid":"请购日期2","名称":"请购日期","标签":"--","绑定":"请购日期","类型":"日期","显示":true,"宽":120,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":13,"格式":"Y-m-d","值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"请购日期2",newValue);}}}},
{"type":"文本框","Eid":"请购单号","名称":"请购单号","标签":"请购单号","绑定":"请购单号","类型":"文本","显示":true,"宽":180,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":60,"值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"请购单号",newValue);}}}},
{"type":"文本框","Eid":"品名","名称":"品名","标签":"品名","绑定":"品名","类型":"文本","显示":true,"宽":150,"占比":-1,"边白":"5 0 0 0","标签位置":"right","标签宽":30,"值":"",listeners:{change:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"品名",newValue);}}}}
],[
{text: '全选',handler:function(o){
var SellistTab=o.up("SellistTab");
var grid=SellistTab.down("xDgrid");
var data=getGridDate(grid);
var ids="-1";
for(i in data){
var row=data[i].data;
ids+=","+row["ID"];
}
if(SellistTab){SellistTab.OtherInfo["条件选择"](o,"全选",ids);}
grid.store.reload();
}},
{text: '全消',handler:function(o){
var SellistTab=o.up("SellistTab");
var grid=SellistTab.down("xDgrid");
var data=getGridDate(grid);
var ids="-1";
for(i in data){
var row=data[i].data;
ids+=","+row["ID"];
}
if(SellistTab){SellistTab.OtherInfo["条件选择"](o,"全消",ids);}
grid.store.reload();
}},
{"type":"平面容器","Eid":"含暂不采购","名称":"暂不采购","宽":"180","高":25,"子件布局":"左右","边框":false,"边白":"0 0 0 0","集合类型":"单下拉框","集合子项":"不含暂不采购,含暂不采购,仅暂不采购","集合值":"不含暂不采购","集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;","子项标签宽":70,集合选择:function(oo,newValue,oldValue){var SellistTab=oo.up("SellistTab");if(SellistTab){SellistTab.OtherInfo["条件选择"](oo,"含暂不采购",newValue);}}},
{"type":"平面容器","Eid":"选择项","名称":"平面容器","宽":"330","高":25,"子件布局":"自适应充满","边框":false,"边白":"0 0 0 30","内边白":"0 0 0 0","html":"","集合类型":"单选框集合","集合子项":"条件查询集合,已选集合,未选集合","集合值":"条件查询集合","集合列数":4,"集合默认选择文本":"条件查询集合","集合子项高度":-1,"集合子项宽度":-1,"集合边白":"0 0 0 0","背景样式":"background:#E6E6E6;"
,集合选择:function(g,newValue){
var SellistTab=g.up("SellistTab");
if(SellistTab){SellistTab.OtherInfo["条件选择"](g,newValue["选择项"],"");}
}
},
{"type":"数字框","Eid":"hebintianshu","名称":"合并天数","小数位":0,"标签":"合并天数","绑定":"Qty","类型":"数值","显示":true,"宽":100,"占比":-1,"边白":"0 0 0 0","标签位置":"right","标签宽":65,"值":"0"},
{text: '合并处理',handler:function(o){
var SellistTab=o.up("SellistTab");
var grid=SellistTab.down("xDgrid");
var data=getGridDate(grid);
var ids="-1";
for(i in data){
var row=data[i].data;
ids+=","+row["ID"];
}
if(SellistTab){SellistTab.OtherInfo["条件选择"](o,"合并处理",ids);}
msg("合并处理完成");
}},
{"type":"数字框","Eid":"拆行","名称":"拆行","小数位":0,"标签":"拆行","绑定":"Qty","类型":"数值","显示":true,"宽":70,"占比":-1,"边白":"0 0 0 0","标签位置":"right","标签宽":30,"值":""},
{text: '拆行处理',handler:function(o){
Ext.MessageBox.confirm("提醒", "确定拆行?", function(cbtn){
if(cbtn=="yes") {
var SellistTab=o.up("SellistTab");
var grid=SellistTab.down("xDgrid");
var caihang_=findEidV(SellistTab,"拆行");
var row=grid.getSelectionModel().getSelection()[0].data;
console.log("row");
console.log(row);
if(caihang_==""){
msg("拆分数量未填");
return;
}
if(caihang_<=0){
msg("拆分数量不能为负数");
return;
}
if(caihang_>=row["采购数"]){
msg("拆分数量只能是大于0小于行采购数");
return;
}
var str=""+row["ID"]+"-"+caihang_+"";
if(SellistTab){SellistTab.OtherInfo["条件选择"](o,"拆行处理",str);}
grid.store.reload();
}});
return;
}},
{text: '关闭当前行',handler:function(o){
Ext.MessageBox.confirm("提醒", "确定关闭该行请购?", function(cbtn){
if(cbtn=="yes") {
var SellistTab=o.up("SellistTab");
var grid=SellistTab.down("xDgrid");
var caihang_=findEidV(SellistTab,"拆行");
var row=grid.getSelectionModel().getSelection()[0].data;
var str=""+row["ID"]+"";
if(SellistTab){SellistTab.OtherInfo["条件选择"](o,"关闭请购行",str);}
var Sql="update PR_PRLine set Sel=0 where Sel=1 and id="+row["ID"]+"";
GetHtmlTB({Lei:"execSql",Sql:Sql});
grid.store.reload();
}});
return;
}},"-",
{text: '待生单汇总',handler:function(o){
var Sql="update t_p_ReportProPR set CreateNo='' where UserID=@User";
GetHtmlTB({Lei:"execSql",Sql:Sql});
openMenu(1584126037465001,{"otherwherels":""});
}}
]]
,表格函数:{
GridChange:function(lei,grid,colCode,o,newext,oldtxt,record,e){
if(lei=="ColChange"){
if(colCode=="下订采购交期"){
newext=newext.Format("yyyy-MM-dd");
}
var Sql="exec p_PM_All '设置"+colCode+"',"+record.data["ID"] +",'"+newext+"'";
console.log(Sql);
var carry= JSON.parse(GetHtmlTB({Lei:"execSql2",Sql:Sql}));
if(carry[0][0]["msg"]!=''){
msg(carry[0][0]["msg"]);
}
WriteLinesForID(grid,carry[1]);
}
}
,itemclick(o, record, item, index, e){
}
,GridCellhref:function(ColEid,record){
console.log(ColEid);
console.log(record);
}
}
,列表开启:function(SellistTab,toolbar,grid){
findEid(SellistTab,"含暂不采购").SetItems("不含暂不采购,含暂不采购,仅暂不采购","不含暂不采购");
console.log(SellistTab);
SellistTab.OtherInfo["条件选择"](SellistTab,"开启","");
console.log(SellistTab);
return;
var Sql="exec p_PM_All '采购员平台开启',@Org,'',@User,@UserName";
var carry= JSON.parse(GetHtmlTB({Lei:"execSql2",Sql:Sql}));
var yewuyuan_=findEid(toolbar,"yewuyuan");
var Company_=findEid(toolbar,"Company");
var CreateNo_=findEid(toolbar,"CreateNo");
var lei1_=findEid(toolbar,"lei1");
var lei2_=findEid(toolbar,"lei2");
var gys_=findEid(toolbar,"gys");
yewuyuan_.setItem(carry[0]);
Company_.setItem(carry[1]);
CreateNo_.setItem(carry[2]);
lei1_.setItem(carry[3]);
lei2_.setItem(carry[4]);
gys_.setItem(carry[5]);
}
,链接事件:function(ColEid,GridEid,GuidStr,fieldName,record){
if(fieldName=="请购单号"){
var Sql="select ID from PR_PR where DocNo='"+record.data["请购单号"]+"'";
var reObj= JSON.parse(GetHtmlTB({Lei:"execSql",Sql:Sql}))[0];
var DocID=reObj["ID"];
openMenu("PR_PR",{"DocID":DocID});
return;
}
if(fieldName=="采购单号"){
var Sql="select ID from PM_PurchaseOrder where DocNo='"+record.data["采购单号"]+"'";
var reObj= JSON.parse(GetHtmlTB({Lei:"execSql",Sql:Sql}))[0];
var DocID=reObj["ID"];
openMenu("PM_PurchaseOrder",{"DocID":DocID});
return;
}
if(fieldName=="料号"){
openMenu(1588329072292001,{"otherwherels":" and Org=@Org and Item="+record.data["Item"]});
return;
}
var row=record.data;
var ids=row["ID"];
var cls='部分选择';
if(row["选择"]=="√"){cls='部分取消';}
var Sql="exec p_PM_All '"+cls+"',0,'"+ids+"',@User,@UserName";
var carry= JSON.parse(GetHtmlTB({Lei:"execSql",Sql:Sql}));
WriteLine(record,carry[0]);
}