|
|
@@ -8,6 +8,7 @@ import com.uas.mes.core.exception.APIErrorException;
|
|
|
import com.uas.mes.core.exception.APIErrorException.APIErrorCode;
|
|
|
import com.uas.mes.core.util.DateUtil;
|
|
|
import com.uas.mes.core.util.FlexJsonUtil;
|
|
|
+import com.uas.mes.core.util.StringUtil;
|
|
|
import com.uas.mes.pda.service.PdaMsdService;
|
|
|
import com.uas.mes.pda.service.PdaSMTService;
|
|
|
import com.uas.mes.pm.service.MakePrepareService;
|
|
|
@@ -187,7 +188,6 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
SqlRowList rs = null;
|
|
|
//判断料卷号工单号不为空
|
|
|
|
|
|
-
|
|
|
Object dl_macode = map.get("DL_MACODE");
|
|
|
Object linecode= map.get("DL_LINECODE"),location = map1.get("dsl_location");
|
|
|
Object table = map.get("DL_TABLE");
|
|
|
@@ -212,8 +212,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
|
|
|
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=? ",map.get("PS_ID"),location, map.get("DL_TABLE"));
|
|
|
- if (rs.next())
|
|
|
- {
|
|
|
+ if (rs.next()) {
|
|
|
psl_prodcode = rs.getString("psl_prodcode");
|
|
|
}
|
|
|
|
|
|
@@ -2249,6 +2248,91 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
return mapR;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 飞达站位绑定,飞达输入框,校验飞达是否存在
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getFeederBindCheck(String fecode,String type) {
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select fe_id,fe_festatus,fe_location,fe_barcode,fe_code from feeder where fe_code=?",fecode);
|
|
|
+ if(rs.next()){
|
|
|
+ if(type.equals("bind")) { //绑定
|
|
|
+ if (!rs.getString("fe_festatus").contains("正常")) {
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达:" + fecode + "状态为" + rs.getString("fe_festatus") + ",不可操作");
|
|
|
+ }
|
|
|
+ if(StringUtil.hasText(rs.getString("fe_location"))) {
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达:"+fecode+"已绑定站位"+rs.getString("fe_location")+"!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(type.equals("unbind")) { //解绑
|
|
|
+ if(!StringUtil.hasText(rs.getString("fe_location"))) {
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达:"+fecode+"未绑定站位,无需解绑!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rs.getCurrentMap();
|
|
|
+ }else{
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达:"+fecode+"不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * * 飞达站位绑定
|
|
|
+ * @param fecode
|
|
|
+ * @param location
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Object> feederBindLocation(String fecode, String location) {
|
|
|
+ Map<String, Object> map = getFeederBindCheck(fecode,"bind");
|
|
|
+ //判断站位是否存在,DeviceLocation
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select * from DeviceLocation where DL_LOCATION=?",location);
|
|
|
+ if(rs.next()){
|
|
|
+ //站位未被其它飞达绑定
|
|
|
+ String bfeeder = baseDao.getJdbcTemplate().queryForObject("select wm_concat(fe_code) from feeder where fe_location=?",String.class,location);
|
|
|
+ if(StringUtil.hasText(bfeeder)){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "站位:"+location+"已经绑定飞达:"+bfeeder);
|
|
|
+ }
|
|
|
+ baseDao.execute("update feeder set fe_location=? where fe_code=?",location,fecode);
|
|
|
+ //如果站位是在线的devsmtlocation 表里面并且dsl_status=0,并且线别非虚拟线别 未校验不可以接料
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_iffeedcheck=-1,DSL_FECODE=? where dsl_id in (select dsl_id from devsmtlocation left join line on dsl_linecode=li_code " +
|
|
|
+ "where dsl_location=? and dsl_status=0 and nvl(li_isvirtual,0)=0)",fecode,location);
|
|
|
+ baseDao.execute("insert into feederlog(FL_ID, FL_FECODE, FL_FEID, FL_TYPE, FL_ITEM, FL_MAN, FL_DATE) " +
|
|
|
+ " select feederlog_seq.nextval,?,?,'绑定站位',?,?,sysdate from dual",fecode,map.get("FE_ID"),"站位:"+location,SystemSession.getUser().getEm_name());
|
|
|
+ Map<String, Object> rmap = new HashMap<>();
|
|
|
+ rmap.put("location",location);
|
|
|
+ rmap.put("fecode",fecode);
|
|
|
+ return rmap;
|
|
|
+ }else{
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "站位:"+location+"不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * * 飞达站位解绑
|
|
|
+ * @param fecode
|
|
|
+ * @param location
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Map<String, Object> feederUnBindLocation(String fecode, String location) {
|
|
|
+ Map<String, Object> map = getFeederBindCheck(fecode,"unbind");
|
|
|
+ if(!location.equals(map.get("FE_LOCATION"))){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "站位:"+location+"和飞达非绑定关系!绑定的飞达为:"+map.get("FE_LOCATION"));
|
|
|
+ }
|
|
|
+ baseDao.execute("update feeder set fe_location=null where fe_code=?",fecode);
|
|
|
+ //如果站位是在线的devsmtlocation 表里面并且dsl_status=0,并且线别非虚拟线别 未校验不可以接料
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_iffeedcheck=0,DSL_FECODE=null where dsl_id in (select dsl_id from devsmtlocation left join line on dsl_linecode=li_code " +
|
|
|
+ "where dsl_location=? and dsl_status=0 and nvl(li_isvirtual,0)=0)",location);
|
|
|
+ baseDao.execute("insert into feederlog(FL_ID, FL_FECODE, FL_FEID, FL_TYPE, FL_ITEM, FL_MAN, FL_DATE) " +
|
|
|
+ " select feederlog_seq.nextval,?,?,'解绑站位',?,?,sysdate from dual",fecode,map.get("FE_ID"),"站位:"+location,SystemSession.getUser().getEm_name());
|
|
|
+ Map<String, Object> rmap = new HashMap<>();
|
|
|
+ rmap.put("location",location);
|
|
|
+ rmap.put("fecode",fecode);
|
|
|
+ return rmap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//因为需要调用两次,所以封装了一个获取未校验站位的方法
|
|
|
private Map<String, Object> quaUnLoading(String linecode,int recheck){
|
|
|
SqlRowList rs = null;
|