Browse Source

Merge remote-tracking branch 'origin/mes_malata_prod' into mes_malata_prod

callm 5 years ago
parent
commit
2f1fa11c78

+ 12 - 2
WebContent/app/controller/common/Query.js

@@ -11,7 +11,9 @@ Ext.define('erp.controller.common.Query', {
 			'erpQueryFormPanel' : {
 				alladded : function(form) {
 					var items = form.items.items, autoQuery = false;
-					Ext.each(items, function() {
+					/*URL传递的Json参数*/
+					var defaultData = getUrlParam("defaultData");
+					Ext.each(items, function(a) {
 						var val = getUrlParam(this.name);
 						if(!Ext.isEmpty(val)) {
 							this.setValue(val);
@@ -20,6 +22,14 @@ Ext.define('erp.controller.common.Query', {
 								this.autoDbfind('form', caller, this.name, this.name + " like '%" + val + "%'");
 							}
 						}
+						//如果传递的参数不为空的话,自动赋值字段执行查询
+						if(defaultData && defaultData != ""){
+							var data=defaultData.split('|');
+							if(data[0]==a.name){
+								a.setValue(data[1]);
+								autoQuery=true;
+							}
+						}
 					});
 					if(autoQuery) {
 						setTimeout(function(){
@@ -29,7 +39,7 @@ Ext.define('erp.controller.common.Query', {
 				}
 			},
 			'button[name=refresh]':{
-    			click: function(btn){   
+    			click: function(btn){
     				var form = me.getForm(btn);
     				if (caller == 'ALMonth!Query'){
     					 var month = Ext.getCmp('am_yearmonth');

+ 20 - 7
WebContent/app/controller/pm/make/MakePlan!Add.js

@@ -136,8 +136,10 @@ Ext.define('erp.controller.pm.make.MakePlan!Add', {
     			},
     			click: function(btn){
     				var linecode = '';
+					var mp_period  ='';
     				if(Ext.getCmp('mp_linecode')){
     					linecode = Ext.getCmp('mp_linecode').value;
+						mp_period  = Ext.getCmp('mp_period').value;
     				}
     				var grid = Ext.getCmp('grid');
 					var me = this;
@@ -216,9 +218,9 @@ Ext.define('erp.controller.pm.make.MakePlan!Add', {
     									'起始时间介于0-23');
     									return;
     						    	}
-    						    	if( b==null ||b>23 || b<0){
+    						    	if( b==null ||b>24 || b<0){
     						    		Ext.Msg.alert('温馨提示',
-    									'结束时间介于0-23');
+    									'结束时间介于0-24');
     									return;
     						    	}
     							    if(b-a>0){
@@ -235,10 +237,13 @@ Ext.define('erp.controller.pm.make.MakePlan!Add', {
     					    			if(i==0){
     					    				for(j=0;j<dataLength+1;j++){
     					    					if(detailgrid.store.data.items[j].data.mpd_planqty ==''||detailgrid.store.data.items[j].data.mpd_planqty ==null){
-						    					    detailgrid.store.data.items[j].set('mpd_datenum','H'+a);
+						    					    detailgrid.store.data.items[j].set('mpd_datenum','H'+(a+1));
 						    						detailgrid.store.data.items[j].set('mpd_planqty',c);
 						    						detailgrid.store.data.items[j].set('mpd_linecode',linecode);
-    						    					a++;
+													if(a<8)
+														detailgrid.store.data.items[j].set('mpd_workdate',Number(mp_period)+1);
+													else
+														detailgrid.store.data.items[j].set('mpd_workdate',mp_period);
 						    						if(a>24){
     						    						a=a-24;
     						    					}
@@ -248,9 +253,13 @@ Ext.define('erp.controller.pm.make.MakePlan!Add', {
     						    			}
     					    			}
     					    			if(m==1){
-    					    					detailgrid.store.data.items[j].set('mpd_datenum','H'+a);
+    					    					detailgrid.store.data.items[j].set('mpd_datenum','H'+(a+1));
     					    					detailgrid.store.data.items[j].set('mpd_planqty',c);
     					    					detailgrid.store.data.items[j].set('mpd_linecode',linecode);
+											if(a<8)
+												detailgrid.store.data.items[j].set('mpd_workdate',Number(mp_period)+1);
+											else
+												detailgrid.store.data.items[j].set('mpd_workdate',mp_period);
     					    					a++;
     					    					if(a>24){
 						    						a=a-24;
@@ -258,10 +267,14 @@ Ext.define('erp.controller.pm.make.MakePlan!Add', {
     						    			    j++;
     					    			}
     					    			if(m==0){
-    					    					detailgrid.store.data.items[j].set('mpd_datenum','H'+a);
+    					    					detailgrid.store.data.items[j].set('mpd_datenum','H'+(a+1));
     					    					detailgrid.store.data.items[j].set('mpd_planqty',c);
     					    					detailgrid.store.data.items[j].set('mpd_linecode',linecode);
-    						    			    length++;
+											if(a<8)
+												detailgrid.store.data.items[j].set('mpd_workdate',Number(mp_period)+1);
+											else
+												detailgrid.store.data.items[j].set('mpd_workdate',mp_period);
+											    length++;
     						    			    a++;
     						    			    if(a>24){
 						    						a=a-24;

+ 11 - 12
src/com/uas/mes/common/dao/impl/SysnavigationDaoImpl.java

@@ -1,15 +1,5 @@
 package com.uas.mes.common.dao.impl;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.stereotype.Repository;
-
 import com.uas.mes.common.dao.SysnavigationDao;
 import com.uas.mes.common.data.BaseDao;
 import com.uas.mes.common.data.JSONTree;
@@ -17,6 +7,15 @@ import com.uas.mes.common.entity.Employee;
 import com.uas.mes.common.entity.EmpsJobs;
 import com.uas.mes.common.entity.SysNavigation;
 import com.uas.mes.common.support.SystemSession;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 @Repository("sysnavigationDao")
 public class SysnavigationDaoImpl extends BaseDao implements SysnavigationDao {
@@ -120,9 +119,9 @@ public class SysnavigationDaoImpl extends BaseDao implements SysnavigationDao {
 				where = "sn_using=1 and case when sn_isleaf='T' then nvl(sn_url,' ') else 'T' end <> ' '";
 			}
 			if (!"admin".equals(employee.getEm_type())) {
-				where += " and (case when sn_isleaf='T' then nvl(sn_caller,' ') else 'T' end = ' ' or case when sn_isleaf='F' then to_char(sn_id) else sn_caller end in(select distinct pp_caller from positionpower where pp_joid=";
+				where += " and (case when sn_isleaf='T' then nvl(sn_caller,' ') else 'T' end = ' ' or case when sn_isleaf='F' then to_char(sn_id) else sn_caller end in(select distinct pp_caller from positionpower where pp_see <> 0 and pp_joid=";
 				where += employee.getEm_defaulthsid() + ")";
-				where += " or case when sn_isleaf='F' then to_char(sn_id) else sn_caller end in(select distinct pp_caller from personalpower where pp_emid=";
+				where += " or case when sn_isleaf='F' then to_char(sn_id) else sn_caller end in(select distinct pp_caller from personalpower where pp_see <> 0 and pp_emid=";
 				where += employee.getEm_id() + "))";
 			}
 			if (search.contains("&&")) {

+ 2 - 0
src/com/uas/mes/pda/service/impl/PdaBatchServiceImpl.java

@@ -130,6 +130,7 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 			mp1.put("BAR_REMAIN", bar_remain);
 			mp1.put("BAR_BATCHQTY", objs[1]);
 			mp1.put("BAR_STATUS", "1");
+			mp1.remove("BAR_PLACE");
 			baseDao.execute(SqlUtil.getInsertSqlByFormStore(mp1, "barcode", new String[] {}, new Object[] {}));
 			// 产生barcodechange记录
 			int bc_id = baseDao.getSeqId("BARCODECHANGE_SEQ");
@@ -292,6 +293,7 @@ public class PdaBatchServiceImpl implements PdaBatchService {
 			mp.put("BAR_REMAIN", total_remain);
 			mp.put("BAR_BATCHQTY", total_remain);
 			mp.put("BAR_STATUS", "1");
+			mp.remove("BAR_PLACE");
 			// 合并成一条barcode
 			baseDao.execute(SqlUtil.getInsertSqlByFormStore(mp, "barcode", new String[] {}, new String[] {}));
 			int bc_id;

+ 60 - 12
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -351,10 +351,10 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+code+"]无上料数据,无需下料",handleType,linecode,"",pr_code,"",bool,table);			
 		}
 		rsReturn = baseDao.queryForRowSet("select max(dsl_location) dsl_location,max(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id,max(dsl_barcode) dsl_barcode,max(dsl_fespec) dsl_fespec,max(dsl_prodcode) dsl_prodcode,wm_concat(nvl(dsl_barcode,dsl_prodcode)) dsl_return from devsmtlocation "
-				+ " where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_location =? and dsl_table =? ",linecode,map.get("DL_MACODE"),dsl_location,map.get("DL_TABLE"));
+				+ " where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_location =? and dsl_table =? ",linecode,map.get("DL_MACODE"),dsl_location,table);
 		if(rsReturn.next()){
 			rs = baseDao.queryForRowSet("select sum(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id, count(1) cn from"
-					+" devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_location =? ",linecode,ma_code,map.get("DL_TABLE"),dsl_location);
+					+" devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_location =? ",linecode,ma_code,table,dsl_location);
 			if(rs.next()){
 				remain = rs.getDouble("dsl_remainqty");  //将第一个料卷剩余料加给第二个料卷
 					if(rs.getInt("cn") == 1){
@@ -363,20 +363,32 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 						}
 					}else{
 						sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where bar_code in (select dsl_barcode from devsmtlocation"
-								+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location='"+dsl_location+"' and dsl_table ='"+map.get("DL_TABLE")+"' and dsl_id<>"+rs.getInt("dsl_id")+")  and bar_place='"+ma_code+"'");
+								+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location='"+dsl_location+"' and dsl_table ='"+table+"' and dsl_id<>"+rs.getInt("dsl_id")+")  and bar_place='"+ma_code+"'");
 						sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+ " where bar_code=(select dsl_barcode from devsmtlocation "
 								+" where dsl_id="+rs.getInt("dsl_id")+" and dsl_linecode='"+linecode+"' and dsl_location='"+dsl_location+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table= '"+map.get("DL_TABLE")+"' ) and bar_place='"+ma_code+"'");
 					}
-					    sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate"
-							+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+map.get("DL_TABLE")+"'");
-				    baseDao.execute(sqls);
+					//记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
+				    sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
+							" ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
+							" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"')"+
+							" and mb_status='已上线'");
+					sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
+							" ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
+							" select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
+							SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+linecode+",工单:"+ma_code+",板面:"+table+",站位:"+dsl_location+",下料'"+
+							" from msdbarcode  where mb_barcode in (select dsl_barcode from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"')"+
+				            " and mb_status='暴露中'");
+
+					sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate"
+						+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"'");
+					baseDao.execute(sqls);
 				    //记录日志下料
 				    rs = baseDao.queryForRowSet("select dl_macode,dl_hasmake from deviceline where dl_linecode =?",linecode);
 					int has_make=0;
 					if(rs.next()){
 						has_make=rs.getInt("dl_hasmake");
 					}
-				    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"下料","下料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+",料卷号或站位:"+code,linecode,dsl_location,0,pr_code,rsReturn.getString("dsl_return"),map.get("DL_TABLE"),has_make == -1?ma_code:"");
+				    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"下料","下料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+",料卷号或站位:"+code,linecode,dsl_location,0,pr_code,rsReturn.getString("dsl_return"),table,has_make == -1?ma_code:"");
 				    return rsReturn.getResultList();
 			}else{
 				showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+"+code+" 无上料数据,无需下料",handleType,linecode,dsl_location,pr_code,"",bool,table);			
@@ -450,6 +462,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		List<String> sqls = new ArrayList<String>();
 			//dsl_usable=2的直接更新bar_place为1,remain为0
 		sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where exists (select 1 from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_table='"+dl_table+"' and nvl(dsl_usable,0) = 2 and dsl_barcode = bar_code)");
+
 		rs = baseDao.queryForRowSet("select dsl_location,cn,dsl_remainqty,dsl_id,dsl_barcode,dsl_baseqty,case when "+actAddQty+">0 then round(dsl_baseqty*(1+0.01*"+lossrate+")*(1/"+pcbacount+")*"+actAddQty+",4) else 0 end remainAddQty " +
 				"from (select dsl_location,count(1)cn,sum(dsl_remainqty)dsl_remainqty,max(dsl_id)dsl_id,max(dsl_barcode)dsl_barcode," +
 				"max(dsl_baseqty)dsl_baseqty " +
@@ -502,6 +515,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}else{
 				sqls.add("update make set ma_smtbqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");									
 			}
+			//更新湿敏条码状态为暴露中,操作日志为全部下料
+			//记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
+			sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
+					" ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
+					" where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 )"+
+					" and mb_status='已上线'");
+			sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
+					" ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
+					" select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
+					SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+dl_linecode+",工单:"+dl_macode+",全部下料'"+
+					" from msdbarcode  where mb_barcode in (select dsl_barcode from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 )"+
+					" and mb_status='暴露中'");
+
 			//更新成下料将数据导入至makesmtlocation
 			sqls.add("update devsmtlocation set dsl_status=-1,dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"' where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 and dsl_usable<>2");
 			sqls.add("insert into makesmtlocation(msl_id,msl_maid,msl_makecode,msl_mcid,msl_mccode,msl_mmdetno,msl_location,msl_prodcode,msl_repcode,msl_fespec,"
@@ -577,7 +603,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				showSmtError(APIErrorCode.BUSINESS_FAILED,"不允许接同一个料卷号",handleType,linecode,location,ps_prodcode,"料卷"+bar_code,bool,table);
 			}
 		}
-		rs1=baseDao.queryForRowSet("select bar_prodcode,bar_place,bar_remain,bar_code from barcode where bar_code=?",bar_code);
+		rs1=baseDao.queryForRowSet("select bar_prodcode,nvl(bar_place,1)bar_place,bar_remain,bar_code from barcode where bar_code=?",bar_code);
 		if(rs1.next()){
 			rs = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
 					+" where psl_psid=? and psl_location=? and psl_table=? and (psl_prodcode=? or psl_repcode=?)",map.get("PS_ID"),location,map.get("DL_TABLE"),rs1.getString("bar_prodcode"),rs1.getString("bar_prodcode"));
@@ -715,7 +741,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			showSmtError(APIErrorCode.BUSINESS_FAILED,"站位未上料无需换料",handleType,linecode,location,ps_prodcode,"",bool,table);
 		}
 		
-		rs2 = baseDao.queryForRowSet("select bar_remain,bar_place,bar_prodcode,bar_code from barcode where bar_code=?",bar_code);
+		rs2 = baseDao.queryForRowSet("select bar_remain,nvl(bar_place,1)bar_place,bar_prodcode,bar_code from barcode where bar_code=?",bar_code);
 		if(rs2.next()){
 			rs = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
 					+" where psl_psid=? and psl_location=? and psl_table=? and (psl_prodcode=? or psl_repcode=?)",map.get("PS_ID"),location,map.get("DL_TABLE"),rs2.getString("bar_prodcode"),rs2.getString("bar_prodcode"));
@@ -791,7 +817,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+ " where bar_code=(select dsl_barcode from devsmtlocation "
 						+" where dsl_id="+rs.getInt("dsl_id")+" and dsl_linecode='"+linecode+"' and dsl_location='"+location+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table= '"+map.get("DL_TABLE")+"' ) and bar_place='"+ma_code+"'");
 			}
-			    
+
+			//记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
+			sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
+					" ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
+					" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+table+"'" +")"+
+					" and mb_status='已上线'");
+			sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
+					" ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
+					" select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
+					SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+linecode+",工单:"+ma_code+",板面:"+table+",站位:"+location+",换料'"+
+					" from msdbarcode where mb_barcode in (select dsl_barcode from devsmtlocation  where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+table+"')"+
+					" and mb_status='暴露中'");
+
 		    rs = baseDao.queryForRowSet("select wm_concat(dsl_barcode) dsl_barcode from"
 					+" devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table='"+map.get("DL_TABLE")+"' and dsl_location ='"+location+"' and nvl(dsl_barcode,' ') <> ' '");
 		    String barcode = null;
@@ -811,6 +849,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		    }else{
 		    	baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"换料","换料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+","+"料卷号:"+barcode+"下料",linecode,location,0,ps_prodcode,"料卷:"+barcode,map.get("DL_TABLE"),has_make == -1?ma_code:"");
 		    }
+
 		    sqls.add("update devsmtlocation  set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate "
 					+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+map.get("DL_TABLE")+"'");
 			baseDao.execute(sqls);
@@ -1011,8 +1050,17 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 						    baseDao.execute("update barcode set bar_place=1"
 										+" where exists(select 1 from devsmtlocation where dsl_linecode=? and dsl_makecode=?  and  dsl_barcode=bar_code "
 										+" and dsl_table=? and dsl_status=0 and dsl_usable<>2) and bar_place=? and (bar_remain<0 or bar_remain=0)",dl_linecode,ma_oldcode,dl_table,ma_oldcode);//原制造单号
-							
-							baseDao.execute("update devsmtlocation set dsl_status=-1, dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"'"
+						   //更新湿敏条码状态为暴露中,操作日志为全部下料
+						   //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
+						   baseDao.execute("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
+								   " ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation  left join barcode on bar_code=dsl_barcode where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+ma_oldcode+"' and dsl_status=0 and dsl_table = '"+dl_table+"' and dsl_usable<>2 and dsl_invalidtime is null and bar_place='1' and (bar_remain<0 or bar_remain=0)) and mb_status='已上线'");
+						   baseDao.execute("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
+								   " ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
+								   " select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
+								   SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+dl_linecode+",工单:"+ma_oldcode+",切换工单'"+
+								   " from msdbarcode  where mb_barcode in(select dsl_barcode from devsmtlocation left join barcode on bar_code=dsl_barcode where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table = ? and dsl_usable<>2 and dsl_invalidtime is null and bar_place='1' and (bar_remain<0 or bar_remain=0)) and mb_status='暴露中'",dl_linecode,ma_oldcode,dl_table);
+
+						   baseDao.execute("update devsmtlocation set dsl_status=-1, dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"'"
 									+" where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table = ? and dsl_usable<>2 and dsl_invalidtime is null",dl_linecode,ma_oldcode,dl_table);//原工单号
 							
 							baseDao.execute("insert into makesmtlocation(msl_id,msl_maid,msl_makecode,msl_mcid,msl_mccode,msl_mmdetno,msl_location,msl_prodcode,msl_repcode,msl_fespec,"

+ 2 - 1
src/com/uas/mes/pm/controller/MakePrepareController.java

@@ -184,7 +184,8 @@ public class MakePrepareController extends BaseController {
 	@ResponseBody
 	public Map<String, Object> getMakePrepareBarcode(int id) {
 		Map<String, Object> modelMap = new HashMap<String, Object>();
-		makePrepareService.getMakePrepareBarcode(id);
+		makePrepareService.getMakePrepareBarcode(id,1);
+		makePrepareService.getMakePrepareBarcode(id,2);
 		modelMap.put("success", true);
 		return modelMap;
 	}

+ 1 - 1
src/com/uas/mes/pm/service/MakePrepareService.java

@@ -28,7 +28,7 @@ public interface MakePrepareService {
 
 	void updateMakePrepare2ById(String caller, String formStore, String param);
 
-	void getMakePrepareBarcode(int id);
+	void getMakePrepareBarcode(int id,int times);
 
 	Map<String, Object> getBar2(String barcode, int mpid);
 	

+ 15 - 19
src/com/uas/mes/pm/service/impl/MakeBaseServiceImpl.java

@@ -1,33 +1,27 @@
 package com.uas.mes.pm.service.impl;
 
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.uas.mes.core.exception.SystemException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.uas.mes.common.dao.MakeDao;
 import com.uas.mes.common.data.BaseDao;
+import com.uas.mes.common.data.SqlUtil;
 import com.uas.mes.common.entity.MessageLog;
 import com.uas.mes.common.support.HandlerService;
 import com.uas.mes.common.support.SystemSession;
+import com.uas.mes.common.util.BaseUtil;
 import com.uas.mes.core.bind.Constant;
 import com.uas.mes.core.bind.Status;
 import com.uas.mes.core.data.Assert;
 import com.uas.mes.core.data.SqlRowList;
+import com.uas.mes.core.exception.SystemException;
 import com.uas.mes.core.support.StateAssert;
-import com.uas.mes.common.util.BaseUtil;
 import com.uas.mes.core.util.DateUtil;
 import com.uas.mes.core.util.StringUtil;
-import com.uas.mes.common.data.SqlUtil;
 import com.uas.mes.pm.service.MakeBaseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
 
 @Service("makeBaseService")
 public class MakeBaseServiceImpl implements MakeBaseService {
@@ -1535,7 +1529,8 @@ public class MakeBaseServiceImpl implements MakeBaseService {
 						+" from rework left join reworkdetail on rd_reid=re_id left join makeserial on ms_sncode=rd_sncode "
 						+" and ms_makecode=rd_scmacode where re_code=? and (nvl(ms_mac,' ')<>' ' or nvl(ms_bt,' ')<>' ')",ma_code,SystemSession.getUser().getEm_name(),re_code);
 				needField1 = "'','','','',''";
-				baseDao.execute("update sninfo set si_mac='',si_bt='',si_othcode1='',si_othcode2='',si_othcode3='' where exists(select 1 from reworkdetail where rd_reid= "+re_id+" and rd_sncode = si_sn)");
+				baseDao.execute("update sninfo set si_mac='',si_bt='',si_othcode1='',si_othcode2='',si_othcode3='' where exists(select 1 from makeserial  join reworkdetail on rd_sncode = ms_sncode and rd_prodcode = ms_prodcode where " +
+						" rd_reid= "+re_id+" and (ms_sncode = si_sn or ms_code = si_sn))");
 			}
 			if(rs.getInt("ma_saveimei")!= 0){
 				needField2 = "ms_imei1,ms_imei2,ms_imei3,MS_NETCODE,ms_othid1,ms_othid2,ms_othid3";
@@ -1545,7 +1540,8 @@ public class MakeBaseServiceImpl implements MakeBaseService {
 						+" from rework left join reworkdetail on rd_reid=re_id left join makeserial on ms_sncode=rd_sncode "
 						+" and ms_makecode=rd_scmacode where re_code=? and (nvl(ms_imei1,' ')<>' 'or nvl(ms_netcode,' ')<>' ')",ma_code,SystemSession.getUser().getEm_name(),re_code);
 				needField2 = "'','','','','','',''";
-				baseDao.execute("update sninfo set si_imei1='',si_imei2='',si_imei3='',si_othid1='',si_othid2='',si_othid3='',si_netcode='' where exists(select 1 from reworkdetail where rd_reid= "+re_id+" and rd_sncode = si_sn)");
+				baseDao.execute("update sninfo set si_imei1='',si_imei2='',si_imei3='',si_othid1='',si_othid2='',si_othid3='',si_netcode='' where exists(select 1 from makeserial  join reworkdetail on rd_sncode = ms_sncode and rd_prodcode = ms_prodcode where " +
+						" rd_reid= "+re_id+" and (ms_sncode = si_sn or ms_code = si_sn))");
 			}
 			
 		    //插入数据值makesnlist,根据返工需求单字段是否SN防呆
@@ -1596,8 +1592,8 @@ public class MakeBaseServiceImpl implements MakeBaseService {
 						+ " where re_id=?  AND nvl(cm_status,0)=0  and cm_barcode=A.ms_sncode and cm_soncode=A.ms_prodcode  and NVL(A.MS_NEXTMACODE,' ')<>' ' AND A.MS_NEXTMACODE=cm_makecode) ",re_id);
 				baseDao.execute(" update craftmaterial set cm_status=-1,cm_dropcode=?,cm_dropman=?,"
 						+" cm_dropdate=sysdate where  exists (select 1  from rework inner join reworkdetail on "
-						+" rd_reid=re_id  inner join makeserial on ms_sncode=rd_sncode and ms_makecode=rd_scmacode inner join makesndecompose on msd_recode=re_code where re_id=? "
-						+" and msd_fsoncode=cm_fsoncode and msd_stepcode=cm_stepcode and cm_firstsn=ms_firstsn)  and  nvl(cm_status,0)=0 ",re_code,SystemSession.getUser().getEm_code(),re_id);
+						+" rd_reid=re_id  inner join makeserial on ms_sncode=rd_sncode or ms_code = rd_sncode inner join makesndecompose on msd_recode=re_code where re_id=? "
+						+" and msd_fsoncode=cm_fsoncode  and (cm_sncode=ms_firstsn or cm_sncode = ms_sncode))  and  nvl(cm_status,0)=0 ",re_code,SystemSession.getUser().getEm_code(),re_id);
 			}
 		}
 		

+ 46 - 32
src/com/uas/mes/pm/service/impl/MakePrepareServiceImpl.java

@@ -1,17 +1,5 @@
 package com.uas.mes.pm.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.stereotype.Service;
-
 import com.alibaba.fastjson.JSON;
 import com.uas.mes.common.data.BaseDao;
 import com.uas.mes.common.data.SqlUtil;
@@ -20,16 +8,19 @@ import com.uas.mes.common.util.BaseUtil;
 import com.uas.mes.core.data.SqlRowList;
 import com.uas.mes.core.exception.SystemException;
 import com.uas.mes.core.support.StateAssert;
-import com.uas.mes.core.util.CollectionUtil;
-import com.uas.mes.core.util.FlexJsonUtil;
-import com.uas.mes.core.util.HttpUtil;
+import com.uas.mes.core.util.*;
 import com.uas.mes.core.util.HttpUtil.Response;
-import com.uas.mes.core.util.NumberUtil;
-import com.uas.mes.core.util.StringUtil;
 import com.uas.mes.pda.dao.PdaCommonDao;
 import com.uas.mes.pm.dao.MakeCraftDao;
 import com.uas.mes.pm.model.Makepreparedetail;
 import com.uas.mes.pm.service.MakePrepareService;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
 
 @Service("makePrepareService")
 public class MakePrepareServiceImpl implements MakePrepareService {
@@ -419,7 +410,8 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 		// 记录操作
 		baseDao.logger.submit(caller, "mp_id", id);
 		if(caller.equals("MakePrepare2") && baseDao.isDBSetting("MakePrepare2", "autoGetMakePrepareBarcode")){//新工单备料 提交自动请求备料信息
-			getMakePrepareBarcode(id);
+			getMakePrepareBarcode(id,1);
+			getMakePrepareBarcode(id,2);
 		}
 		// 执行提交后的其它逻辑
 		handlerService.afterSubmit(caller, new Object[] { id });
@@ -606,7 +598,7 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 	}
 
 	@Override
-	public void getMakePrepareBarcode(int id) {
+	public void getMakePrepareBarcode(int id,int times) {
 		SqlRowList rs = baseDao.queryForRowSet("select mp_code,mp_id from MakePrepare where nvl(mp_pstatus,' ') = '待取料'");
 		if(rs.next()){
 			BaseUtil.showErrorOnSuccess("备料单:["+rs.getGeneralString("mp_code")+"],状态为待取料请优先处理!");
@@ -629,14 +621,26 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 		}
 		Object lineCode = mpMsg[1];
 		Object mpCode = mpMsg[0];
-		//备料信息整合
-		List<Makepreparedetail> matList = baseDao.getJdbcTemplate().query("select MD_PRODCODE partNumber,MD_NEEDQTY quantity,'"+lineCode+"' productLine,MD_LOCATION feederLocation "
-				+ "from makePreparedetail where md_barcode is null and md_mpid = "+id,new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
+		List<Makepreparedetail> matList =null;
+		if (times==1) {
+			//备料信息整合
+		 matList = baseDao.getJdbcTemplate().query("select MD_PRODCODE partNumber,MD_NEEDQTY quantity,'" + lineCode + "' productLine,MD_LOCATION feederLocation "
+					+ "from makePreparedetail where md_barcode is null and md_mpid = " + id, new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
+		}else {
+			//备料信息整合
+		 matList = baseDao.getJdbcTemplate().query("select max(md_repcode) partNumber,MD_NEEDQTY quantity,'" + lineCode + "' productLine,MD_LOCATION feederLocation " +
+					"from makePreparedetail where md_barcode is null and md_prodcode <> md_repcode and md_repcode is not null and md_mpid = " + id + " group by MD_NEEDQTY,MD_LOCATION", new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
+		}
+
 		if(!CollectionUtil.isEmpty(matList)){
 			mpMap.put("send", isProd);
 			mpMap.put("user", "system");
 			mpMap.put("color", 3);
-			mpMap.put("orderid", mpCode);
+			if(times==1) {
+				mpMap.put("orderid", mpCode);
+			}else {
+				mpMap.put("orderid", mpCode.toString()+times);
+			}
 			mpMap.put("orderName", mpCode);
 			mpMap.put("matList", matList);
 			String sendMpList = JSON.toJSONString(mpMap);
@@ -671,11 +675,21 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 									List<Map<Object, Object>> resMatlist = (List<Map<Object, Object>>) resMatlistStr;
 									for (Iterator iterator = resMatlist.iterator(); iterator.hasNext();) {
 										Map<Object, Object> map = (Map<Object, Object>) iterator.next();
-										sqls.add("update makePreparedetail set MD_COLOR = "+color+"," +
-												"MD_BARCODE = (case when MD_BARCODE is null then '"+map.get("uid")+"|' else MD_BARCODE||'"+map.get("uid")+"|' end), " +
-												" md_qty = nvl(md_qty,0) + "+map.get("qty")+", " +
-												"MD_SHELFID = (case when MD_SHELFID is null then '"+map.get("shelfid")+"|' else MD_SHELFID||'"+map.get("shelfid")+"|' end)"
-												+ "where MD_PRODCODE = '"+map.get("matid")+"' and MD_LOCATION ='"+map.get("feederLocation")+"' and md_mpid = "+id);
+										if (times ==1) {
+											sqls.add("update makePreparedetail set MD_COLOR = " + color + "," +
+													"MD_BARCODE = (case when MD_BARCODE is null then '" + map.get("uid") + "|' else MD_BARCODE||'" + map.get("uid") + "|' end), " +
+													" md_qty = nvl(md_qty,0) + " + map.get("qty") + ", " +
+													"MD_SHELFID = (case when MD_SHELFID is null then '" + map.get("shelfid") + "|' else MD_SHELFID||'" + map.get("shelfid") + "|' end)"
+													+ "where MD_PRODCODE = '" + map.get("matid") + "' and MD_LOCATION ='" + map.get("feederLocation") + "' and md_mpid = " + id);
+										}
+										else
+										{
+											sqls.add("update makePreparedetail set MD_COLOR = " + color + "," +
+													"MD_BARCODE = (case when MD_BARCODE is null then '" + map.get("uid") + "|' else MD_BARCODE||'" + map.get("uid") + "|' end), " +
+													" md_qty = nvl(md_qty,0) + " + map.get("qty") + ", " +
+													"MD_SHELFID = (case when MD_SHELFID is null then '" + map.get("shelfid") + "|' else MD_SHELFID||'" + map.get("shelfid") + "|' end)"
+													+ "where md_repcode = '" + map.get("matid") + "' and MD_LOCATION ='" + map.get("feederLocation") + "' and md_mpid = " + id);
+										}
 										sqls.add("insert into MakePrepareDetaildet (MDD_ID,MDD_MPID,MDD_PRODCODE,MDD_LOCATION,MDD_BARCODE,MDD_QTY,MD_SHELFID) " +
 												"values (MAKEPREPAREDETAILDET_SEQ.nextval,"+id+",'"+map.get("matid")+"','"+map.get("feederLocation")+"','"+map.get("uid")+"',"+map.get("qty")+",'"+map.get("shelfid")+"')");
 										//sqls.add("update barcode set bar_place='"+mpCode+"' where bar_code='" + map.get("uid") + "'");
@@ -683,9 +697,9 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 									baseDao.execute(sqls);
 								}
 								//更新主表备料状态
-								baseDao.execute("update MakePrepare set mp_pstatus = '待领料' where mp_id = "+id
+								baseDao.execute("update MakePrepare set mp_pstatus = '待领料',mp_getdate=sysdate where mp_id = "+id
 										+ " and exists (select 1 from makePreparedetail where md_barcode is not null and md_mpid = mp_id and nvl(md_status,' ') <> '已领料' )");
-								baseDao.execute(baseDao.logger.getMessageLog("获取料卷号", "获取成功", "MakePrepare2", "mp_id", id).getSql());
+								baseDao.execute(baseDao.logger.getMessageLog("获取料卷号", "获取成功"+times, "MakePrepare2", "mp_id", id).getSql());
 						}
 					}else{
 						BaseUtil.showErrorOnSuccess("获取备料信息为空!");
@@ -851,9 +865,9 @@ public class MakePrepareServiceImpl implements MakePrepareService {
 //		if(rs.getGeneralInt("md_color") > 0){
 //			BaseUtil.showError("料卷号:" + barcode + ",为料架备料,不允许退回!");
 //		}
-		if(rs.getGeneralString("md_status").equals("已领料")){
+		/*if(rs.getGeneralString("md_status").equals("已领料")){
 			BaseUtil.showError("料卷号:" + barcode + ",已领料,不允许退回!");
-		}
+		}*/
 		// 更新备料明细中料卷已备数量为空
 		baseDao.execute("update  MakePrepareDetail set md_barcode = replace(MD_BARCODE,'"+barcode+"|','')," +
 				"md_qty = md_qty - nvl((select sum(MDD_QTY) from MakePrepareDetaildet where MDD_MPID = md_mpid and MDD_PRODCODE = md_prodcode and MDD_LOCATION = MD_LOCATION and MDD_barcode = '"+barcode+"' ),0) " +

+ 1 - 1
src/com/uas/mes/pm/service/impl/SNBatchServiceImpl.java

@@ -105,7 +105,7 @@ public class SNBatchServiceImpl implements SNBatchService {
 					" max(ms_firstsn)ms_firstsn,max(ms_prodcode)ms_prodcode,max(ms_makecode)ms_makecode,max(MS_SALECODE)MS_SALECODE"+
 					",max(MS_BADTIMES)MS_BADTIMES,max(MS_IMEI1)MS_IMEI1,max(MS_IMEI2)MS_IMEI2,max(MS_MAC)MS_MAC,max(MS_BT)MS_BT,max(SIR_REMARK)SIR_REMARK,"+
 					" max(SIR_SOFTVER)SIR_SOFTVER,"+
-					" max(case when pr_detail like '%板%' then cm_barcode else ' ' end) 主板"+
+					" max(case when pr_detail like '%板%' then cm_barcode else ' ' end) 主板"+
 					",max(case when pr_detail like '%屏%' then cm_barcode else ' ' end) 液晶屏"+
 					",max(case when pr_detail like '%电池%' then cm_barcode else ' ' end) 电池"+
 					",max(case when pr_detail like '%KEY%' then cm_barcode else ' ' end)  KEY"+

+ 2 - 0
src/com/uas/mes/scm/service/impl/GenerateBarcodeServiceImpl.java

@@ -555,6 +555,7 @@ public class GenerateBarcodeServiceImpl implements GenerateBarcodeService{ //生
 						mp.put("BAR_REMAIN", total_remain);
 						mp.put("BAR_BATCHQTY", total_remain);
 						mp.put("BAR_STATUS", "1");
+					    mp.remove("BAR_PLACE");
 						// 合并成一条barcode
 						baseDao.execute(SqlUtil.getInsertSqlByMap(mp, "barcode"));
 						int bc_id;
@@ -690,6 +691,7 @@ public class GenerateBarcodeServiceImpl implements GenerateBarcodeService{ //生
 			mp1.put("BAR_REMAIN", bar_remain);
 			mp1.put("BAR_STATUS", "1");
 			mp1.put("BAR_RECORDDATE", DateUtil.format(null, "yyyy-MM-dd HH:mm:ss"));
+			mp1.remove("BAR_PLACE");
 			baseDao.execute(SqlUtil.getInsertSqlByFormStore(mp1, "barcode", new String[] {}, new Object[] {}));
 			// 产生barcodechange记录
 			baseDao.execute("insert into barcodeChange(bc_id,bc_prodcode,bc_kind,bc_indate,bc_inman,bc_reason,bc_qty,bc_barcode,bc_barid,bc_newbarcode,bc_newbarid,bc_newqty) "