瀏覽代碼

SMT工单切换之前先锁deviceline 和devsmtlocation 表3秒

xiaost 5 年之前
父節點
當前提交
cc4c98e22f
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

+ 15 - 1
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -927,7 +927,21 @@ public class PdaSMTServiceImpl implements PdaSMTService {
         List<String> sqls = new ArrayList<String>();
         if(dl_actmadeqty == null || ("").equals(dl_actmadeqty)){
     	   dl_actmadeqty=0;
-       }   
+       }
+        //执行切换之前,先锁deviceline 表和devicesmtlocation
+		try {
+			baseDao.execute("select dl_id from deviceline where dl_linecode=? for update wait 3", dl_linecode);
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"请等待其它操作执行之后再进行切换操作");
+		}
+		try {
+			baseDao.execute("select dsl_id from devsmtlocation where dsl_linecode=? for update wait 3", dl_linecode);
+		} catch (Exception e) {
+			System.out.println(e.getMessage());
+			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"请等待其它操作执行之后再进行切换操作");
+		}
+
        //先判断传过来的值dl_madeqty,必须大于0,并且介于dl_madeqty和ma_qty之间
   		if(dl_actmadeqty<0){
   			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"产出数不允许小于0");