| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.scm.reserve.ProdInOut', {
- extend: 'Ext.app.Controller',
- requires: ['erp.util.FormUtil', 'erp.util.GridUtil', 'erp.util.BaseUtil'],
- views:[
- 'core.form.Panel','scm.reserve.ProdInOut','core.grid.Panel2','core.toolbar.Toolbar','core.form.MultiField','core.form.YnField',
- 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.PrintA4','core.button.Upload','core.button.ResAudit',
- 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail','core.button.ResSubmit',
- 'core.button.Banned','core.button.ResBanned','core.button.Post','core.button.ResPost','core.button.Query','core.button.GetPrice',
- 'core.button.RePrice','core.button.BussAccount','core.button.Export','core.form.FtFindField','core.form.ConDateField','core.button.UpdateWHCode',
- 'core.button.FeeShare', 'core.button.TurnDefectOut','core.button.Resetbatch','core.button.PrintwithPrice','core.button.tecai','core.button.GridWin',
- 'core.button.TurnExOut', 'core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger','core.trigger.TextAreaTrigger','core.button.TurnProdinoutReturn',
- 'core.button.TurnProdinoutIn','core.button.UpdatePdprice', 'core.button.PrintNoPrice', 'core.button.PrintPrice','core.form.FileField','core.button.TurnOutReturn',
- 'core.button.Split','core.button.TurnReturn','core.button.PrintBar','core.button.Printotherin','core.button.Printotherout', 'core.button.TurnProdOut',
- 'core.button.TurnOtherIn', 'core.button.TurnOtherOut', 'core.button.TurnOtherPurcOut','core.button.TurnAppropriationOut','core.button.TurnCustReturnOut',
- 'core.button.ClearSubpackage','core.button.Subpackage','core.grid.YnColumn','core.button.CatchBatch','core.button.Printnosale','core.button.PrintNoCustomer',
- 'core.button.SetMMQTY','core.button.TurnSaleReturn','core.button.TurnMrb','core.button.Barcode','core.button.TurnReturnMake','core.button.SendData'
- ],
- init:function(){
- var me = this;
- var grid = Ext.getCmp('grid');
- me.FormUtil = Ext.create('erp.util.FormUtil');
- me.GridUtil = Ext.create('erp.util.GridUtil');
- me.BaseUtil = Ext.create('erp.util.BaseUtil');
- this.control({
- 'erpTurnReturnMakeButton':{//销售退货转返修工单
- afterrender:function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- postStatus = Ext.getCmp('pi_statuscode');
- if((status && status.value != 'AUDITED')||(postStatus&&postStatus.value!='POSTED')){
- btn.hide();
- }
- },
- click: function(btn){
-
- me.batchdeal('ProdInOut!SaleReturn', 'pd_piid=' + Ext.getCmp('pi_id').value,'scm/purchase/turnReturnMake.action');
- }
- },
- 'erpCatchBatchButton' : {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value == 'POSTED'){
- btn.hide();
- }
- },
- click: function(btn){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/catchBatch.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res){
- if(res.exceptionInfo) {
- showMessage('提示', res.exceptionInfo);
- } else {
- if(res.log==null||res.log=='')
- showMessage('提示', '抓取成功');
- me.GridUtil.loadNewStore(grid,{
- caller:caller,
- condition:gridCondition
- });
- }
- }else{
- showMessage('提示', '抓取失败');
- }
- }
- });
- }
- },
- 'erpGridPanel2': {
- afterrender: function(grid){
- grid.plugins[0].on('beforeedit', function(args){
- if(args.field == "pd_inqty") {
- return me.isAllowUpdateQty(args.record);
- }
- });
- if(caller=='ProdInOut!SaleReturn'){
- if(Ext.getCmp('pi_sourcecode')&&Ext.getCmp('pi_sourcecode').value!=""){
- grid.readOnly = true;
- }
- }
- },
- // reconfigure: function(grid) {
- // var f = Ext.getCmp('pi_id');
- // if(caller == 'ProdInOut!OtherOut'){
- // if (f && !Ext.isEmpty(f.value)) {
- // me.loadOnHandQty(grid, f.value);
- // }
- // }
- // },
- itemclick: function(selModel, record){
- var bool = me.hasSource(selModel.ownerCt);
- if(caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if(record.data.pd_id > 0){
- var btn = selModel.ownerCt.down('#erpEditSubpackageButton');
- if(btn && !btn.hidden)
- btn.setDisabled(false);
- }
- }
- if(record.data.pd_id != 0 && record.data.pd_id != null && record.data.pd_id != ''){
- var btn = Ext.getCmp('updatebgxh');
- btn && btn.setDisabled(false);
- btn = Ext.getCmp('barcodebtn');
- btn && btn.setDisabled(false);
- }
- if(!bool)
- this.GridUtil.onGridItemClick(selModel, record);
- }
- },
- /**
- * 更改报关型号
- */
- '#updatebgxh': {
- click: function(btn) {
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.Updatebgxh(record);
- }
- },
- 'erpBarcodeButton':{
- click: function(btn){
- var pdid=btn.ownerCt.ownerCt.ownerCt.items.items[1].selModel.selected.items[0].data["pd_id"];
- var id = Ext.getCmp("pi_id").value;
- var formCondition1="pd_idIS"+pdid+" and pi_idIS'"+id+"'";
- var gridCondition1="bi_pdidIS"+pdid+" and bi_piidIS'"+id+"'";
- var linkCaller ='';
- //获取出入库单DS_INOROUT字段判读是出库单还是入库单
- Ext.Ajax.request({
- url : basePath + '/pm/bom/getDescription.action',
- params: {
- tablename:"documentsetup" ,
- field:'ds_inorout',
- condition:"ds_name='"+Ext.getCmp("pi_class").value+"'",
- caller:caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- var inOrOut = res.description ;
- if(inOrOut == "IN" || inOrOut == "-OUT"){
- linkCaller = "ProdInOut!BarcodeIn";
- }else if(inOrOut == "-IN" || inOrOut == "OUT"){
- linkCaller = "ProdInOut!BarcodeOut";
- }
- var win = new Ext.window.Window({
- id : 'win',
- height : '90%',
- width : '95%',
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items : [ {
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_'+linkCaller+'" src="'+basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+linkCaller+'&formCondition='+formCondition1+'&gridCondition='+gridCondition1+'" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
- }],
- listeners:{
- 'beforeclose':function(view ,opt){
- var postStatus = Ext.getCmp('pi_statuscode');
- if(postStatus && postStatus.value != 'POSTED'){
- var grid = Ext.getCmp("grid");
- me.GridUtil.loadNewStore(grid,{
- caller:caller,
- condition:gridCondition
- });
- }
- }
- }
- });
- win.show();
- }
- }
- });
- },
- afterrender:function(btn) {
- btn.setDisabled(true);
- }
- },
- 'erpDeleteDetailButton': {
- afterrender: function(btn){
- btn.ownerCt.add({
- xtype: 'erpBarcodeButton'
- });
- if(caller=='ProdInOut!Sale'){
- btn.ownerCt.add({
- xtype:'button',
- text:'比例信息维护',
- width:120,
- iconCls: 'x-button-icon-check',
- cls: 'x-btn-gray',
- id:'UpdateProdInoutrateButton',
- style: {
- marginLeft: '10px'
- },
- handler:function(){
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.updatepdscaleremark(record);
- }
- });
- }
- }
- },
- '#erpEditSubpackageButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_invostatuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
- me.EditSubpackage(record);
- }
- },
- 'erpTurnProdinoutReturnButton':{
- click:function(btn){
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url : basePath + 'scm/sale/turnTurnProdinoutReturn.action',
- params: {
- id: id
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(res.log)
- showMessage('提示', res.log);
- }
- }
- });
- }
- },
- 'erpTurnReturnButton':{
- beforerender:function(btn){
- btn.setText('转借货归还单');
- },
- afterrender:function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- postStatus = Ext.getCmp('pi_statuscode');
- if((status && status.value != 'AUDITED') ||(postStatus && postStatus.value == 'POSTED')){
- btn.hide();
- }
- },
- click:function(){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/turnOutReturn.action',
- params: {
- id: Ext.getCmp('pi_id').value,
- caller:caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- if(res.log)
- showMessage('提示', res.log);
- }
- });
- }
- },
- 'erpSplitButton':{
- click:function(btn){
- warnMsg("确定拆分单据?", function(btn){
- if(btn == 'yes'){
- var id = Ext.getCmp('pi_id').value;
- var piclass = Ext.getCmp('pi_class').value;
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/split.action',
- params: {
- id: id,
- caller:caller,
- cls:piclass
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo) {
- showError(res.exceptionInfo);
- } else {
- if(res.log)
- showMessage('提示', res.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpGridWinButton':{
- afterrender: function(btn){
- var id = Ext.getCmp('pi_id').value;
- btn.setConfig({
- text: '费用明细',
- caller: 'ProdChargeDetail!CGYS',
- condition: 'pd_piid=' + id,
- paramConfig: {
- pd_piid: id
- }
- });
- },
- beforesave : function(btn) {
- var f = btn.ownerCt.ownerCt, p = f.down('field[name=pi_statuscode]');
- if (p && 'POSTED' == p.getValue()) {
- Ext.Msg.alert("提示","该单据已经过账,不能修改费用明细!");
- return false;
- }
- return true;
- }
- /*aftersave:function(){
- //验收单ID
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/updatepdPrice.action',
- params: {
- id: id
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- window.location.reload();
- if(!res.bool){
- btn.hide();
- }
- }
- });
- }*/
- //yaozx@13-12-04
- /*aftersave:function(btn){
- var items = Ext.getCmp('grid').store.data.items;
- var totalcount,parentCount;
- var rate,pd_prcie;
- Ext.Array.each(items, function(item){
- rate = item.data['pd_rate']==0?1:item.data['pd_rate'];
- totalcount = Number(totalcount) + rate*item.data['pd_amount'];
- });
- var parentItems = parent.Ext.getCmp('grid').store.data.items;
- Ext.Array.each(parentItems, function(item){
- parentCount = Number(parentCount)+item.data['pd_inqty']*item.data['pd_orderprice']*(1+item.data['pd_taxrate']/100);
- });
- rate = parent.Ext.getCmp('pi_rate').value==0?1:Ext.getCmp('pi_rate').value;
- parentCount = Number(parentCount)*rate;
- if(Number(parentCount)>0&&Number(parentCount)>0){
- Ext.Array.each(parentItems, function(item){
- pd_prcie = item.data['pd_orderprice']*(1+item.data['pd_taxrate']/100)+Number(parentCount)/item.data['pd_inqty']*totalcount;
- item.set('pd_prcie', pd_prcie );
- });
- }
- }*/
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
- me.BaseUtil.getRandomNumber(caller, 2, form.codeField);//自动添加编号
- }
- me.save(btn);
- }
- },
- 'erpPrintA4Button': {
- click: function(btn) {
- var reportName = '';
- var reportName = "piolist_bc4";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpUpdatePdpriceButton':{
- click:function(btn){
- var p = Ext.getCmp('pi_statuscode');
- if (p && 'POSTED' == p.getValue()) {
- Ext.Msg.alert("提示","该单据已经过账,不能修改费用明细!");
- return ;
- }
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/updatepdPrice.action',
- params: {
- id: id
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- window.location.reload();
- if(!res.bool){
- btn.hide();
- }
- }
- });
- }
- },
- 'erpDeleteButton' : {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value == 'DELETED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onDelete({pu_id: Number(Ext.getCmp('pi_id').value)});
- }
- },
- 'erpResetbatchButton':{
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value != 'UNPOST'){
- btn.hide();
- }/*else{
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/checkresetBatchcode.action',
- params: {
- caller: caller
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(!res.bool){
- btn.hide();
- }
- }
- });
- }*/
- },
- click: function(btn){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/resetBatchcode.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- } else if(res.success){
- Ext.Msg.alert("提示","批号重置成功!");
- }
- }
- });
- }
-
- },
- 'erpUpdateButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- status = Ext.getCmp('pi_statuscode');
- if(status && 'POSTED' == status.value) {
- btn.hide();
- }
- },
- click: function(btn){
- var grid = Ext.getCmp('grid'), items = grid.store.data.items, c = Ext.getCmp('pi_inoutno').value;
- var piclass = Ext.getCmp('pi_class').value;
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- item.set('pd_inoutno', c);
- item.set('pd_piclass', piclass);
- }
- if(caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if(item.data['pd_unitpackage'] == null || item.data['pd_unitpackage'] == ''||
- item.data['pd_unitpackage'] == '0' || item.data['pd_unitpackage'] == 0){
- item.set('pd_unitpackage', item.data['pd_inqty']);
- }
- }
- });
- if(caller !='ProdInOut!AppropriationOut' && caller != 'ProdInOut!AppropriationIn' ) {
- var whcode = Ext.getCmp('pi_whcode'), whname = Ext.getCmp('pi_whname');
- if(whcode && whname) {
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- if(Ext.isEmpty(item.data['pd_whcode'])){
- item.set('pd_whcode', whcode.value);
- item.set('pd_whname', whname.value);
- }
- }
- });
- }
- }
-
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if(caller == 'ProdInOut!Make!Return') {
- var firstItem = grid.store.getAt(0);
- if(firstItem) {
- var desc = firstItem.get('pd_description'), dc = firstItem.get('pd_departmentcode'),
- dn = firstItem.get('pd_departmentname'), whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname');
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- if(Ext.isEmpty(item.data['pd_description'])){
- item.set('pd_description', desc);
- }
- if(Ext.isEmpty(item.data['pd_departmentcode'])){
- item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);
- }
- if(Ext.isEmpty(item.data['pd_whcode'])){
- item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);
- }
- }
- });
- }
- }
- me.FormUtil.onUpdate(me);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('add' + caller, '新增出入库单', "jsps/scm/reserve/prodInOut.jsp?whoami=" + caller);
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- me.FormUtil.beforeClose(me);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- var grid = Ext.getCmp('grid');
- var items = grid.store.data.items;
- var bool = true;
- if(caller=='ProdInOut!OtherIn'||caller=='ProdInOut!OtherOut'){
- var type = Ext.getCmp('pi_type').value;
- if(type==null||type==''){
- showError("主表类型字段未填写,不能提交!");return;
- }
- }
- /*Ext.each(items, function(item){
- if(item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != ''){
- if(item.data['pd_outqty'] == null || item.data['pd_outqty'] == ''){
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");return;
- }
- }
- });*/
- if(caller=='ProdInOut!AppropriationOut'){
- Ext.each(items, function(item){
- if(item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != ''){
- if(Ext.getCmp('pd_outqty') && item.data['pd_outqty'] == null || item.data['pd_outqty'] == ''){
- bool = false;
- showError("明细第" + item.data['pd_pdno'] + "行出库数量未填写,不能提交");return;
- }
- }
- });
- }
- if(bool){
- me.FormUtil.onSubmit(Ext.getCmp('pi_id').value);
- }
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('pi_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('pi_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField),
- postStatus = Ext.getCmp('pi_statuscode');
- if((status && status.value != 'AUDITED') ||(postStatus && postStatus.value == 'POSTED')){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('pi_id').value);
- }
- },
- 'erpBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onBanned(Ext.getCmp('pi_id').value);
- }
- },
- 'erpResBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'BANNED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResBanned(Ext.getCmp('pi_id').value);
- }
- },
- 'erpPrintButton': {
- click:function(btn){
- me.onPrint();
- }
- },
- 'erpPrintotherinButton':{// 返修机入仓单
- click: function(btn){
- var reportName = "piolist_otherin";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintotheroutButton':{// 返修机出仓单
- click: function(btn){
- var reportName = "piolist_otherout";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintwithPriceButton':{// 无价打印==erpPrintButton
- click: function(btn){
- var reportName = "sendlist_yessale_yesprice";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintPriceButton':{// (有价)打印,和erpPrintwithPriceButton一样,某些客户需要默认为有效
- click: function(btn){
- var reportName = "sendlist_yessale_yesprice";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintnosaleButton':{// 无PO打印
- click: function(btn){
- var reportName = "sendlist_nosale";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintNoCustomerButton':{// 无客户打印
- click: function(btn){
- var reportName = "sendlist_yessale_nocustomer";
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpPrintNoPriceButton':{// 无价打印==erpPrintButton
- click: function(btn){
- me.onPrint();
- }
- },
- 'erpPostButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value != 'UNPOST'){
- btn.hide();
- }
- },
- buffer : 1000,
- click: function(btn){
- me.FormUtil.onPost(Ext.getCmp('pi_id').value);
- }
- },
- 'erptecaiButton':{
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(caller!='ProdInOut!DefectIn'|| status.value != 'POSTED'){
- btn.hide();
- }
- },
- click: function(btn){
- var pi_id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/erptecai.action',
- params: {
- caller: caller,
- id: pi_id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- },
- 'erpResPostButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value != 'POSTED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResPost(Ext.getCmp('pi_id').value);
- }
- },
- 'erpTurnProdinoutIn':{
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(caller=='ProdInOut!OtherOut' && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- var id = Ext.getCmp('pi_id').value;
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/turnProdinoutIn.action',
- params: {
- id: id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- },
- 'erpSetMMQTYButton':{
- click:function(btn){
- warnMsg("确认本次发料数为当前维护的实际可发数?", function(btn){
- if(btn == 'yes'){
- me.FormUtil.setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/SetMMQTY.action',
- params: {
- id: Ext.getCmp('pi_id').value,
- caller:caller
- },
- method : 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- window.location.reload();
- }
- });
- }
- });
- }
- },
- 'dbfindtrigger[name=pd_ordercode]': {
- focus: function(t){
- t.setHideTrigger(false);
- t.setReadOnly(false);
- if(Ext.getCmp('pi_cardcode')){
- var code = Ext.getCmp('pi_cardcode').value;
- if(code != null && code != ''){
- var obj = me.getCodeCondition();
- if(obj && obj.field){
- t.dbBaseCondition = obj.field + "='" + code + "'";
- }
- }
- }
- if(caller=='ProdInOut!OutReturn'){//借货归还单
- var code = Ext.getCmp('pi_cardcode').value;
- if(code != null && code != ''){
- if(t.dbBaseCondition==null||t.dbBaseCondition==''){
- t.dbBaseCondition= "pi_cardcode='"+code+"'";
- }else{
- t.dbBaseCondition=t.dbBaseCondition+" and pi_cardcode='"+code+"'";
- }
- }
- }
- },
- aftertrigger: function(t){
- if(Ext.getCmp('pi_cardcode')){
- var obj = me.getCodeCondition();
- if(obj && obj.fields){
- me.FormUtil.getFieldsValue(obj.tablename, obj.fields, obj.myfield + "='" + t.value + "'", obj.tFields);
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_orderdetno]': {
- focus: function(t){
- t.setHideTrigger(false);
- t.setReadOnly(false);//用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var code = record.data['pd_ordercode'];
- if(code == null || code == ''){
- showError("请先选择关联单号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var field = me.getBaseCondition();
- if(field){
- t.dbBaseCondition = field + "='" + code + "'";
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_whcode]':{
- aftertrigger: function(t){
- if(caller=='ProdInOut!AppropriationOut'||caller=='ProdInOut!Sale'||caller=='ProdInOut!AppropriationIn'){
- var inwhcode=t.value;
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var prodcode=record.data['pd_prodcode'];
- if(prodcode&&inwhcode){
- var obj = {tablename:'productWH',fields:'pw_onhand'};
- me.FormUtil.getFieldsValue(obj.tablename, obj.fields,"pw_whcode='"+inwhcode+"' AND pw_prodcode='"+prodcode+"'" , "pd_inqty",record);
- }
- }
- }
- },
- 'multidbfindtrigger[name=pd_orderdetno]': {
- focus: function(t){
- t.setHideTrigger(false);
- t.setReadOnly(false);//用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var code = record.data['pd_ordercode'];
- if(code == null || code == ''){
- showError("请先选择关联单号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var field = me.getBaseCondition();
- if(field){
- t.dbBaseCondition = field + "='" + code + "'";
- }
- }
- }
- },
- 'dbfindtrigger[name=pd_batchcode]': {
- focus: function(t){
- t.setHideTrigger(false);
- t.setReadOnly(false);//用disable()可以,但enable()无效
- var record = Ext.getCmp('grid').selModel.lastSelected;
- var pr = record.data['pd_prodcode'];
- if(pr == null || pr == ''){
- showError("请先选择料号!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var code = record.data['pd_whcode'];
- if(code == null || code == ''){
- if(Ext.getCmp('pi_whcode')) {
- code = Ext.getCmp('pi_whcode').value;
- if(code == null || code == ''){
- showError("请先选择仓库!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_prodcode='" + pr + "'";
- }
- } else {
- t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
- }
- }
- }
- },
- 'field[name=pi_whcode]': {
- aftertrigger: function(f){
- if(f.value != null && f.value != ''){
- var grid = Ext.getCmp('grid');
- var whname = Ext.getCmp('pi_whname');
- Ext.Array.each(grid.store.data.items, function(item){
- if(item.data['pd_whcode'] == null || item.data['pd_whcode'] == ''){
- item.set('pd_whcode', f.value);
- item.set('pd_whname', whname.value);
- }
- });
- }
- }
- },
- 'field[name=pi_purpose]': {
- aftertrigger: function(f){
- if(f.value != null && f.value != ''){
- var grid = Ext.getCmp('grid');
- var posename = Ext.getCmp('pi_purposename');
- Ext.Array.each(grid.store.data.items, function(item){
- if(item.data['pd_inwhcode'] == null || item.data['pd_inwhcode'] == ''){
- item.set('pd_inwhcode', f.value);
- if(posename){
- item.set('pd_inwhname', posename.value);
- }
-
- }
- });
- }
- }
- },
- 'dbfindtrigger[name=pi_paymentcode]': {
- afterrender:function(trigger){
- if(trigger.fieldConfig == 'PT') {
- trigger.dbKey='pi_cardcode';
- if(caller=='ProdInOut!Sale' || caller=='ProdInOut!SaleReturn' || caller=='ProdInOut!SaleBorrow'){
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- }
- }
- },
- 'dbfindtrigger[name=pi_custcode2]': {
- afterrender:function(trigger){
- trigger.dbKey='pi_cardcode';
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- },
- 'dbfindtrigger[name=pi_invoiceremark]': {
- afterrender:function(trigger){
- trigger.dbKey='pi_cardcode';
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- },
- 'dbfindtrigger[name=pi_packingremark]': {
- afterrender:function(trigger){
- trigger.dbKey='pi_cardcode';
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- },
- /* 'dbfindtrigger[name=pi_receivecode]': {
- afterrender:function(trigger){
- if (caller == 'ProdInOut!Sale') {
- trigger.dbKey='pi_cardcode';
- trigger.mappingKey='cu_code';
- trigger.dbMessage='请先选客户编号!';
- }
- }
- },*/ //万利达收货客户可以随意改成其他客户
- 'erpGetPriceButton': {
- click: function(){
-
- }
- },
- 'erpTurnMrbButton':{
- afterrender: function(btn){
- var status = Ext.getCmp("pi_statuscode");
- if(status && status.value != 'POSTED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.batchdeal('ProdIO!ToMRB!Deal', 'pd_piid=' + Ext.getCmp('pi_id').value + ' AND nvl(pd_yqty,0)<pd_inqty+pd_outqty','scm/reserve/turnMRB.action');
-
- }
- },
- 'erpSubpackageButton':{
- afterrender: function(btn){
- var status = Ext.getCmp('pi_invostatuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- warnMsg("确定分装?", function(btn){
- if(btn == 'yes'){
- me.FormUtil.setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/Subpackage.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method : 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpClearSubpackageButton':{
- afterrender: function(btn){
- var status = Ext.getCmp('pi_invostatuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- warnMsg("确定清除分装?", function(btn){
- if(btn == 'yes'){
- me.FormUtil.setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/ClearSubpackage.action',
- params: {
- id: Ext.getCmp('pi_id').value
- },
- method : 'post',
- callback: function(opt, s, r) {
- me.FormUtil.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- if(rs.log)
- showMessage('提示', rs.log);
- }
- }
- });
- }
- });
- }
- },
- 'erpPrintBarButton':{
- click: function(btn){
- var reportName = "bar_53";
- var condition = '{ProdIODetailBar.pdb_inoutno}=' +"'"+ Ext.getCmp('pi_inoutno').value + "'";
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- /**
- * 发送出货单数据
- */
- 'erpSendDataButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('pi_statuscode');
- if(status && status.value == 'POSTED' && (caller == 'ProdInOut!Sale')){
- btn.show();
- }
- },
- click: function(btn) {
- var pi_id = Ext.getCmp('pi_id').value;
- var pi_class = Ext.getCmp('pi_class').value;
- Ext.getBody().mask("waiting...");
- if (caller == 'ProdInOut!Sale') {
- Ext.Ajax.request({
- url: basePath + "scm/reserve/inOutPut/syncToSqlServer.action",
- params: {
- id: pi_id,
- caller: caller
- },
- method: 'post',
- callback: function (options, success, response) {
- Ext.getBody().unmask();
- var res = new Ext.decode(response.responseText);
- if (res.success) {
- showMessage("提示","发送完成");
- }else{
- showError(res.exceptionInfo||"发送失败");
- return;
- }
- }
- });
- }
- }
- }
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- save: function(btn){
- var me = this;
- var form = me.getForm(btn);
- if(Ext.getCmp('Fin_Code')){
- Ext.getCmp('Fin_Code').setValue(Ext.getCmp(form.codeField).value);//流水号
- }
- var grid = Ext.getCmp('grid'), items = grid.store.data.items, c = Ext.getCmp('pi_inoutno').value;
- var piclass = Ext.getCmp('pi_class').value;
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- item.set('pd_inoutno', c);
- item.set('pd_piclass', piclass);
- }
- });
- if(caller =='ProdInOut!AppropriationOut'){
- var recorder=Ext.getCmp('pi_recordman');
- if(recorder){
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- if(Ext.isEmpty(item.data['pd_seller'])){
- item.set('pd_seller', recorder.value);
- }
- }
- });
- }
- }
- if(caller !='ProdInOut!AppropriationOut' && caller != 'ProdInOut!AppropriationIn' ) {
- var whcode = Ext.getCmp('pi_whcode'), whname = Ext.getCmp('pi_whname');
- if(whcode && whname) {
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- if(Ext.isEmpty(item.data['pd_whcode'])){
- item.set('pd_whcode', whcode.value);
- item.set('pd_whname', whname.value);
- }
- if(caller == 'ProdInOut!OtherIn' || caller == 'ProdInOut!OtherPurcIn') {
- if(item.data['pd_unitpackage'] == null || item.data['pd_unitpackage'] == ''||
- item.data['pd_unitpackage'] == '0' || item.data['pd_unitpackage'] == 0){
- item.set('pd_unitpackage', item.data['pd_inqty']);
- }
- }
- }
- });
- }
- }
- // 拨入单、拨出单,默认第一行的仓库
- me.setDetailWarehouse(grid);
- if(caller == 'ProdInOut!Make!Return') {
- var firstItem = grid.store.getAt(0);
- if(firstItem) {
- var desc = firstItem.get('pd_description'), dc = firstItem.get('pd_departmentcode'),
- dn = firstItem.get('pd_departmentname'), whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname');
- Ext.Array.each(items, function(item){
- if(!Ext.isEmpty(item.data['pd_prodcode'])){
- if(Ext.isEmpty(item.data['pd_description'])){
- item.set('pd_description', desc);
- }
- if(Ext.isEmpty(item.data['pd_departmentcode'])){
- item.set('pd_departmentcode', dc);
- item.set('pd_departmentname', dn);
- }
- if(Ext.isEmpty(item.data['pd_whcode'])){
- item.set('pd_whcode', whcode);
- item.set('pd_whname', whname);
- }
- }
- });
- }
- }
- me.FormUtil.beforeSave(me);
- },
- setDetailWarehouse : function(grid) {
- var me = this;
- if('ProdInOut!AppropriationIn' == caller || 'ProdInOut!AppropriationOut' == caller) {
- var firstItem = grid.store.getAt(0);
- if(firstItem) {
- var whcode = firstItem.get('pd_whcode'),
- whname = firstItem.get('pd_whname'),
- inwhcode = firstItem.get('pd_inwhcode'),
- inwhname = firstItem.get('pd_inwhname');
- grid.store.each(function(){
- if(!me.GridUtil.isBlank(grid, this.data)) {
- if(Ext.isEmpty(this.get('pd_whcode'))) {
- this.set('pd_whcode', whcode);
- this.set('pd_whname', whname);
- }
- if(Ext.isEmpty(this.get('pd_inwhcode'))) {
- this.set('pd_inwhcode', inwhcode);
- this.set('pd_inwhname', inwhname);
- }
- }
- });
- }
- }
- },
- /**
- * pd_orderdetno的限制条件
- */
- getBaseCondition: function(){
- var field = null;
- switch (caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = "pd_code";break;
- case 'ProdInOut!PurcCheckout': //采购验退单
- field = "pd_code";break;
- case 'ProdInOut!Sale': //出货单
- field = "sd_code";break;
- case 'ProdInOut!Make!Return': //生产退料单
- field = "mm_code";break;
- case 'ProdInOut!Make!Give': //生产补料单
- field = "mm_code";break;
- case 'ProdInOut!Picking': //生产领料单
- field = "mm_code";break;
- case 'ProdInOut!Make!Consume': //生产耗料单
- field = "mm_code";break;
- case 'ProdInOut!Make!Useless': //生产报废单
- field = "mm_code";break;
- case 'ProdInOut!SaleAppropriationOut': //销售拨出单
- field = "sd_code";break;
- case 'ProdInOut!SaleReturn': //销售退货单
- field = "sd_code";break;
- case 'ProdInOut!OtherOut': //其它出库单
- field = "sd_code";break;
- case 'ProdInOut!OutsidePicking': //委外领料单
- field = "ma_code";break;
- case 'ProdInOut!OutsideReturn': //委外退料单
- field = "mm_code";break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = "pd_code";break;
- case 'ProdInOut!DefectOut': //不良品入库单
- field = "pd_code";break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = "mm_code";break;
- case 'ProdInOut!OSMake!Give': //委外补料单
- field = "mm_code";break;
- case 'ProdInOut!SampleSale': //样品出货单
- field = "sd_code";break;
- case 'ProdInOut!SampleMake!Give': //工程补料单
- field = "mm_code";break;
- case 'ProdInOut!SamplePicking': //工程领料单
- field = "mm_code";break;
- case 'ProdInOut!PurcCheckin!PLM': //研发采购验收单
- field = "pd_code";break;
- case 'ProdInOut!PurcCheckout!PLM': //研发采购验退单
- field = "pd_code";break;
- case 'ProdInOut!PartitionStockIn': //拆件入库单
- field = "mm_code";break;
- }
- return field;
- },
- /**
- * pd_ordercode的限制条件
- */
- updatepdscaleremark:function(record){
- var win = Ext.create('Ext.Window', {
- id: 'win',
- title: '发货比例信息维护',
- height: 300,
- width: 400,
- items: [{
- margin: '3 0 0 0',
- id:'pd_scaleremark',
- xtype: 'textfield',
- fieldLabel: '比例备注',
- name:'pd_scaleremark',
- value:record.data.pd_scaleremark
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: '保存信息',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var id = record.data.pd_id;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updatepdscaleremark.action',
- params: {
- id: id,
- field:'pd_id',
- data:Ext.getCmp('pd_scaleremark').value
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- saveSuccess(function(){
- window.location.reload();
- });
- }
- }
- });
- }
- },{
- text: '保存全部',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var id = record.data.pd_piid;
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updatepdscaleremark.action',
- params: {
- id: id,
- field:'pd_piid',
- data:Ext.getCmp('pd_scaleremark').value
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- saveSuccess(function(){
- window.location.reload();
- });
- }
- }
- });
- }
- },{
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.ownerCt.ownerCt.hide();
- }
- }]
- });
- win.show();
- },
- getCodeCondition: function(){
- var field = null;
- var fields = '';
- var tablename = '';
- var myfield = '';
- var tFields = '';
- switch (caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!PurcCheckout': //采购验退单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!Sale': //出货单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
- fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!AppropriationIn': //拨入单
- tFields = 'pi_cardcode,pi_title';
- fields = 'ma_custcode,ma_custname';
- tablename = 'Make';
- myfield = 'ma_code';
- field = "ma_custcode";
- break;
- case 'ProdInOut!SaleAppropriationOut': //销售拨出单
- tFields = 'pi_cardid,pi_cardcode,pi_title';
- fields = 'sa_custid,sa_custcode,sa_custname';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!SaleReturn': //销售退货单
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
- fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
- tablename = 'Sale';
- myfield = 'sa_code';
- field = "sa_custcode";
- break;
- case 'ProdInOut!AppropriationOut': //拨出单
- tFields = 'pi_cardcode,pi_title';
- fields = 'ma_custcode,ma_custname';
- tablename = 'Make';
- myfield = 'ma_code';
- field = "ma_custcode";
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!DefectOut': //不良品出库单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!OutsidePicking': //委外领料单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutsideReturn': //委外退料单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutesideCheckReturn': //委外验退单
- field = "ma_vendcode";
- tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname,pi_currency,pi_rate';
- fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname,ma_currency,ma_rate';
- tablename = 'Make';
- myfield = 'ma_code';
- break;
- case 'ProdInOut!OutReturn'://借货归还单
- tFields = 'pi_sellercode,pi_belongs,pi_cop,pi_shr,pi_expresscode,pi_emcode,pi_emname,pi_address';
- fields = 'pi_emcode,pi_emname,pi_cop,pi_shr,pi_expresscode,pi_emcode,pi_emname,pi_address';
- tablename = 'ProdInOut';
- myfield = 'pi_inoutno';
- break;
- case 'ProdInOut!PurcCheckin!PLM': //研发采购验收单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- case 'ProdInOut!PurcCheckout!PLM': //研发采购验退单
- field = "pu_vendcode";
- tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate,pi_receivecode,pi_receivename';
- fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate,pu_receivecode,pu_receivename';
- tablename = 'Purchase';
- myfield = 'pu_code';
- break;
- }
- var obj = new Object();
- obj.field = field;
- obj.fields = fields;
- obj.tFields = tFields;
- obj.tablename = tablename;
- obj.myfield = myfield;
- return obj;
- },
- /**
- * 有来源不能新增明细
- */
- hasSource: function(grid) {
- var bool = false,field = null;
- switch(caller) {
- // case 'ProdInOut!Sale'://出货单
- // field = 'pd_snid';
- // break;
- case 'ProdInOut!PurcCheckin': //采购验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- field = 'pd_qcid';
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- field = 'pd_qcid';
- break;
- }
- if(field != null) {
- var s = null;
- grid.store.each(function(item){
- s = item.get(field);
- if(s != null && s != '' && s > 0) {
- bool = true;return;
- }
- });
- }
- return bool;
- },
- isAllowUpdateQty: function(record) {
- var bool = true;
- switch(caller) {
- case 'ProdInOut!PurcCheckin': //采购验收单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!OutsideCheckIn': //委外验收单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!DefectIn': //不良品入库单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- case 'ProdInOut!Make!In': //完工入库单
- if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
- bool = false;
- break;
- }
- return bool;
- },
- onPrint : function() {
- var me = this, whichKind = Ext.getCmp('pi_class').value;
- var reportName = '';
- if(whichKind=="出货单"){
- reportName="sendlist_yessale";
- }else if(whichKind=="无订单出货单"){
- reportName="sendlist_nosale";
- }
- else if(whichKind=="不良品入库单"){
- //console.log("fds");
- reportName="pio_notokin";
- }else if(whichKind=="不良品出库单"){
- reportName="pio_notokout";
- }else if(whichKind=="其它采购入库单"){
- reportName="piolist_opin";
- }else if(whichKind=="其它采购出库单"){
- reportName="piolist_opout";
- }else if(whichKind=="拨入单"){
- reportName="piolist_br";
- }else if(whichKind=="拨出单"){
- reportName="piolist_bc";
- }else if(whichKind=="其它入库单"){
- reportName="piolist_in";
- }else if(whichKind=="其它出库单"){
- reportName="piolist_out";
- }else if(whichKind=="报废单"){
- reportName="piolist_bf";
- }else if(whichKind=="换货入库单"){
- reportName="pio_changein";
- }else if(whichKind=="换货出库单"){
- reportName="pio_changeout";
- }else if(whichKind=="销售退货单"){
- reportName="retulist";
- }else if(whichKind=="采购验收单"){
- reportName="acclist";
- }else if(whichKind=="采购验退单"){
- reportName="piolist_yt";
- }else if(whichKind=="销售拨入单"){
- reportName="piolist";
- }else if(whichKind=="销售拨出单"){
- reportName="piolist_salebc";
- }else if(whichKind=="生产领料单"){
- reportName="PIOLISTM";
- }else if(whichKind=="生产退料单"){
- reportName="PIOLISTM_Back";
- }else if(whichKind=="完工入库单"){
- reportName="finish";
- }else if(whichKind=="结余退料单"){
- reportName="PIOLISTM_JY";
- }else if(whichKind=="拆件入库单"){
- reportName="chaijian";
- }else if(whichKind=="生产补料单"){
- reportName="PIOLIST_bl";
- }else if(whichKind=="生产耗料单"){
- reportName="PIOLISTM_HL";
- }else if(whichKind=="委外领料单"){
- reportName="Expiolist";
- }else if(whichKind=="委外退料单"){
- reportName="PIOLIST_wwtl";
- }else if(whichKind=="委外验收单"){
- reportName="EXPLIST_ys";
- }else if(whichKind=="委外验退单"){
- reportName="EXPLIST_yt";
- }else if(whichKind=="生产报废单"){
- reportName="MakeScrap";
- }else if(whichKind=="无订单退货单"){
- reportName="retulist_nosale";
- }else if(whichKind=="委外补料单"){
- reportName="Expiolist";
- }else if(whichKind=="盘盈调整单"){
- reportName="piolist_tz";
- }else if(whichKind=="盘亏调整单"){
- reportName="piolist_tz";
- }else if(whichKind=="辅料入库单"){
- reportName="piolist_flr";
- }else if(whichKind=="辅料出库单"){
- reportName="piolist_flc";
- }else if(whichKind=="研发领料单"){
- reportName="piolist_yfll";
- }else if(whichKind=="研发退料单"){
- reportName="piolist_yftl";
- }else if(whichKind=="借货出货单"){
- reportName="sendlist_jh";
- }else if(whichKind=="借货归还单"){
- reportName="sendlist_jhgh";
- }
- var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
- var id = Ext.getCmp('pi_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- },
- /**
- *编辑分装明细
- **/
- EditSubpackage:function(record){
- var width = Ext.isIE ? screen.width*0.7*0.9 : '80%',
- height = Ext.isIE ? screen.height*0.75 : '100%';
- var pd_id = record.get('pd_id');
- Ext.create('Ext.Window', {
- width: width,
- height: height,
- autoShow: true,
- layout: 'anchor',
- items: [{
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_dbfind" src="' + basePath + 'jsps/scm/reserve/prodIODetail.jsp?formCondition=pd_id='
- + pd_id + '&gridCondition=pdb_pdid=' + pd_id + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }]
- });
- },
- loadOnHandQty: function(grid, id) {
- Ext.Ajax.request({
- url: basePath + 'scm/reserve/loadOnHandQty.action',
- params: {
- caller: caller,
- id: id
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if (rs.exceptionInfo) {
- showMessage('提示', rs.exceptionInfo.replace('AFTERSUCCESS', ''));
- } else {
- var data = [];
- if (!rs.data || rs.data.length == 2) {
- grid.GridUtil.add10EmptyData(grid.detno, data);
- grid.GridUtil.add10EmptyData(grid.detno, data);
- } else {
- data = Ext.decode(rs.data.replace(/,}/g, '}').replace(/,]/g, ']'));
- }
- grid.store.loadData(data);
- }
- }
- });
- },
- Updatebgxh:function(record){
- var win = this.bgxhwindow;
- if (!win) {
- win = this.getBgxhWindow();
- }
- win.show();
- },
- getBgxhWindow : function() {
- var me = this;
- return Ext.create('Ext.window.Window',{
- width: 330,
- height: 180,
- closeAction: 'hide',
- cls: 'custom-blue',
- title:'<h1>更改报关型号</h1>',
- layout: {
- type: 'vbox'
- },
- items:[{
- margin: '5 0 0 5',
- xtype:'textfield',
- fieldLabel:'报关型号',
- name:'pd_bgxh',
- id:'pd_bgxh'
- },{
- margin: '5 0 0 5',
- xtype: 'fieldcontainer',
- fieldLabel: '全部更新',
- combineErrors: false,
- defaults: {
- hideLabel: true
- },
- layout: {
- type: 'column',
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype:'checkbox',
- columnidth: 0.4,
- fieldLabel:'全部更新',
- name:'allupdate',
- id:'allupdate'
- },{
- xtype:'displayfield',
- fieldStyle:'color:red',
- columnidth: 0.6,
- value:' *更改当前所有明细'
- }]
- }],
- buttonAlign:'center',
- buttons:[{
- xtype:'button',
- text:'保存',
- width:60,
- iconCls: 'x-button-icon-save',
- handler:function(btn){
- var w = btn.up('window');
- me.saveBgxh(w);
- w.hide();
- }
- },{
- xtype:'button',
- columnWidth:0.1,
- text:'关闭',
- width:60,
- iconCls: 'x-button-icon-close',
- margin:'0 0 0 10',
- handler:function(btn){
- btn.up('window').hide();
- }
- }]
- });
- },
- saveBgxh: function(w) {
- var pd_bgxh = w.down('field[name=pd_bgxh]').getValue(),
- grid = Ext.getCmp('grid'),
- record = grid.getSelectionModel().getLastSelected();
- if(!pd_bgxh) {
- showError('请先设置报关型号.') ;
- return;
- } else {
- var allupdate = w.down('field[name=allupdate]').getValue();
- var dd = {
- pd_id : record.data.pd_id,
- pd_piid : record.data.pd_piid,
- pd_bgxh : pd_bgxh ? pd_bgxh : null,
- allupdate : allupdate ? 1 : 0,
- caller: caller
- };
- Ext.Ajax.request({
- url : basePath +'scm/reserve/updatebgxh.action',
- params : {
- _noc: 1,
- data: unescape(Ext.JSON.encode(dd))
- },
- method : 'post',
- callback : function(opt, s, res){
- var r = new Ext.decode(res.responseText);
- if(r.success){
- showMessage('提示', '更新成功!', 1000);
- } else if(r.exceptionInfo){
- showError(r.exceptionInfo);
- } else{
- saveFailure();
- }
- }
- });
- }
- },
- batchdeal: function(nCaller, condition, url){
- console.log('url: '+url);
- var win = new Ext.window.Window({
- id : 'win',
- height: "100%",
- width: "80%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [{
- tag : 'iframe',
- frame : true,
- anchor : '100% 100%',
- layout : 'fit',
- html : '<iframe id="iframe_' + caller + '" src="' + basePath + 'jsps/common/editorColumn.jsp?caller=' + nCaller
- + "&condition=" + condition +'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
- }],
- buttons : [{
- name: 'confirm',
- text : $I18N.common.button.erpConfirmButton,
- iconCls: 'x-button-icon-confirm',
- cls: 'x-btn-gray',
- listeners: {
- buffer: 500,
- click: function(btn) {
- var grid = Ext.getCmp('win').items.items[0].body.dom.getElementsByTagName('iframe')[0].contentWindow.Ext.getCmp("editorColumnGridPanel");
- btn.setDisabled(true);
- grid.updateAction(url);
- win.close();
- //window.location.reload();
- }
- }
- }, {
- text : $I18N.common.button.erpCloseButton,
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- handler : function(){
- Ext.getCmp('win').close();
- }
- }]
- });
- win.show();
- }
- });
|