|
|
@@ -2,6 +2,7 @@ package com.uas.mes.pda.service.impl;
|
|
|
|
|
|
import com.uas.mes.common.data.BaseDao;
|
|
|
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.data.SqlRowList;
|
|
|
import com.uas.mes.core.exception.APIErrorException;
|
|
|
@@ -256,9 +257,24 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
}
|
|
|
double ma_qty=0;
|
|
|
- rs = baseDao.queryForRowSet("select ma_qty from make where ma_id=?",map.get("MA_ID"));
|
|
|
+ rs = baseDao.queryForRowSet("select ma_qty,ma_custcode from make where ma_id=?",map.get("MA_ID"));
|
|
|
if(rs.next()){
|
|
|
ma_qty = rs.getDouble("ma_qty");
|
|
|
+ if(baseDao.getFieldDataByCondition("configs","data","caller='MESSetting' and code='LD'").toString().equals("1")){
|
|
|
+ String ma_custcode=rs.getString("ma_custcode");
|
|
|
+ String barcode=bar_code.toString();
|
|
|
+ //如果是联迪B2工单号
|
|
|
+ if(ma_custcode.equals("W00397")){
|
|
|
+ if(!barcode.substring(barcode.length()-2).equals("IN")||pr_code.length()==barcode.length()){
|
|
|
+ BaseUtil.showError("该工单不允许采集此条码,请采集IN后缀条码");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(barcode.substring(barcode.length()-2).equals("IN")){
|
|
|
+ if(!ma_custcode.equals("W00397")){
|
|
|
+ BaseUtil.showError("该工单不允许采集IN后缀条码,请采集其他条码");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
/**
|
|
|
* @author wuyx
|
|
|
@@ -1396,6 +1412,89 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
return mapR;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> checkDataRepeat(String dsl,String deviceLineMake) {
|
|
|
+ Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
|
|
|
+ Map<Object, Object> map1 = FlexJsonUtil.fromJson(dsl);
|
|
|
+ String ma_prodcode = null;
|
|
|
+ String ma_code = String.valueOf(map.get("DL_MACODE"));
|
|
|
+ Object linecode = map.get("DL_LINECODE");
|
|
|
+ Object dl_prodcode = map.get("DL_PRODCODE");
|
|
|
+ String table = null;
|
|
|
+ Object location = map1.get("dsl_location");
|
|
|
+ Object prodcode = map1.get("dsl_prodcode");
|
|
|
+ Integer ps_id = 0;
|
|
|
+ Integer dl_id = 0;
|
|
|
+ boolean success = Boolean.valueOf(String.valueOf(map1.get("success")));
|
|
|
+ SqlRowList rs;
|
|
|
+ int cn=0;
|
|
|
+ cn=baseDao.getCount("select count(1) from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_table ='"+map.get("DL_TABLE")+"' and dsl_location = '"+map1.get("dsl_location")+"' and dsl_status = 0");
|
|
|
+ if(cn==0){
|
|
|
+ baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"复检校验","校验失败,站位未上料",linecode,location,-1,map.get("DL_PRODCODE"),"",map.get("DL_TABLE"),Integer.valueOf(returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("hasmake").toString()) == -1 ? returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("macode"):"");
|
|
|
+ throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"无上料记录!");
|
|
|
+ }
|
|
|
+ //校验成功
|
|
|
+ if(success){
|
|
|
+ rs = baseDao.queryForRowSet("select dl_id,dl_hasmake,dl_smtid,dl_table,dl_decode,dl_prodcode from deviceline where dl_linecode=? and dl_macode=?",linecode,ma_code);
|
|
|
+ if(rs.next()){
|
|
|
+ dl_id = rs.getInt("dl_id");
|
|
|
+ table = rs.getString("dl_table");
|
|
|
+ ma_prodcode = rs.getString("dl_prodcode");
|
|
|
+ //无论上料还是接料,判断devsmtlocation 表中是否有记录,并且是否有料卷号,
|
|
|
+ //有记录,没有料卷号 --上料,接料:则更新物料编号. 有料卷号--上料、接料:则更新成已校验
|
|
|
+ ps_id = baseDao.getJdbcTemplate().queryForObject("select max(ps_id) from productsmt left join productsmtlocation on psl_psid=ps_id where ps_linecode=? and ps_prodcode=? and ps_statuscode='AUDITED' AND PSL_TABLE=?", Integer.class,linecode,ma_prodcode,table);
|
|
|
+ if(ps_id == null ||ps_id == 0){
|
|
|
+ throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别+产品对应的站位表不存在!");
|
|
|
+ }else if(ps_id!=rs.getInt("dl_smtid")){//更新排位表ID
|
|
|
+
|
|
|
+ }
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_ifcheck=-1 where dsl_linecode=? and dsl_makecode=? and dsl_location=? and dsl_status=0",linecode,ma_code,location);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //成功失败都记录日志
|
|
|
+ int i=0;String meg = "校验成功";
|
|
|
+ if(!success){
|
|
|
+ i =-1;
|
|
|
+ meg = "校验失败";
|
|
|
+ }
|
|
|
+ baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"复检校验",meg+",料号:"+prodcode,linecode,location,i,map.get("DL_PRODCODE"),"",map.get("DL_TABLE"),Integer.valueOf(returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("hasmake").toString()) == -1 ? returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("macode"):"");
|
|
|
+ if(success)
|
|
|
+ {
|
|
|
+ baseDao.execute("update smtmessagelog set sml_confirm = -1 where sml_linecode = '"+linecode+"' and sml_type = '接料原物料号校验' and sml_location = '"+location+"' and sml_date > sysdate-1/2 and sml_table = '"+map.get("DL_TABLE")+"'");
|
|
|
+ }
|
|
|
+ //ps_id,table,linecode,ma_code,table
|
|
|
+ Map<String,Object> mapR = new HashMap <String, Object>();
|
|
|
+ rs=baseDao.queryForRowSet("select * from (select psl_location from(select min(psl_detno)psl_detno,psl_location from productsmtlocation "
|
|
|
+ +" where psl_psid=? and psl_table=? and psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_ifcheck = -1) "
|
|
|
+ +" group by psl_location order by psl_detno)) where rownum<=20 ",ps_id,table,linecode,ma_code,table);
|
|
|
+ if(rs.next()){
|
|
|
+ mapR.put("NotCheckLocation", rs.getResultList());
|
|
|
+ }else{
|
|
|
+ mapR.put("NotCheckLocation", "");
|
|
|
+ }
|
|
|
+ rs=baseDao.queryForRowSet("select count(1) cn from (select distinct psl_location from productsmtlocation where psl_psid=? and psl_table=? and "
|
|
|
+ +" psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_ifcheck = -1)) ",ps_id,table,linecode,ma_code,table);
|
|
|
+ if(rs.next()){
|
|
|
+ mapR.put("NotCheckCount", rs.getInt("cn"));
|
|
|
+ }else{
|
|
|
+ mapR.put("NotCheckCount",0);
|
|
|
+ }
|
|
|
+ if(success){
|
|
|
+ Integer psl_id = baseDao.getJdbcTemplate().queryForObject("select max(psl_id) from productsmtlocation where psl_psid=? and psl_table=? and (psl_location,psl_prodcode) "
|
|
|
+ +" not in(select dsl_location,dsl_fprodcode from devsmtlocation where dsl_linecode=? "
|
|
|
+ +" and dsl_makecode=? and dsl_status=0 and dsl_ifcheck=-1)",Integer.class,ps_id,table,linecode,ma_code);
|
|
|
+ if(psl_id == null || psl_id == 0){
|
|
|
+ baseDao.execute("update deviceline set dl_checkcount=nvl(dl_checkcount,0)+1 where dl_id=?",dl_id);
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_ifcheck = 0 where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0",linecode,ma_code,table);
|
|
|
+ baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"复检校验","完成一次校验",linecode,"",0,map.get("DL_PRODCODE"),"",map.get("DL_TABLE"),Integer.valueOf(returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("hasmake").toString()) == -1 ? returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("macode"):"");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapR;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 针对输入的工单号进行模糊查询
|
|
|
*/
|
|
|
@@ -1538,9 +1637,21 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
baseDao.execute("update smtmessagelog set sml_confirm = -1 where sml_type = '接料原物料号校验' and sml_linecode = '"+linecode+"' and sml_date > sysdate-1/2 and sml_table = '"+rs.getString("dl_table")+"'");
|
|
|
}
|
|
|
return unLoading(linecode);
|
|
|
- }
|
|
|
-
|
|
|
- //因为需要调用两次,所以封装了一个获取未校验站位的方法
|
|
|
+ }
|
|
|
+
|
|
|
+ //重新校验
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> startCheckRepeat(String linecode) {
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_ifcheck =0 where dsl_linecode = ? and dsl_status = 0 and dsl_ifcheck = -1",linecode);
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select dl_prodcode,dl_table from deviceline where dl_linecode = ?",linecode);
|
|
|
+ if(rs.next()){
|
|
|
+ baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"复检校验","重新校验",linecode,"",0,rs.getString("dl_prodcode"),"",rs.getString("dl_table"),Integer.valueOf(returnMake(linecode,rs.getString("dl_prodcode"),rs.getString("dl_table")).get("hasmake").toString()) == -1 ? returnMake(linecode,rs.getString("dl_prodcode"),rs.getString("dl_table")).get("macode"):"");
|
|
|
+ baseDao.execute("update smtmessagelog set sml_confirm = -1 where sml_type = '接料原物料号校验' and sml_linecode = '"+linecode+"' and sml_date > sysdate-1/2 and sml_table = '"+rs.getString("dl_table")+"'");
|
|
|
+ }
|
|
|
+ return unLoading(linecode);
|
|
|
+ }
|
|
|
+
|
|
|
+ //因为需要调用两次,所以封装了一个获取未校验站位的方法
|
|
|
private Map<String, Object> unLoading(String linecode){
|
|
|
SqlRowList rs = null;
|
|
|
Object macode = null;
|