Przeglądaj źródła

【微浦MES】条码上料判定增加制造单明细表校验

caosy 4 lat temu
rodzic
commit
dd61ad0aa3

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

@@ -251,7 +251,10 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				if(!rs1.next()){
 					rs1 = baseDao.queryForRowSet("select bd_mothercode,bd_soncode,prr_reprodcode from PRODUCTRELATION left join bomdetail on bd_id = prr_bdid where bd_mothercode = ? and bd_soncode = ? and prr_reprodcode = ?",ps_prodcode,psl_prodcode,rs.getString("bar_prodcode"));
 					if(!rs1.next()) {
-						showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+						rs1 = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@WP where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%"+rs.getString("bar_prodcode")+"%'",dl_macode,ps_prodcode,psl_prodcode);
+						if(!rs1.next()) {
+							showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+						}
 					}
 				}
 			}
@@ -653,7 +656,10 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				if(!rs.next()){
 					rs = baseDao.queryForRowSet("select bd_mothercode,bd_soncode,prr_reprodcode from PRODUCTRELATION left join bomdetail on bd_id = prr_bdid where bd_mothercode = ? and bd_soncode = ? and prr_reprodcode = ?",ps_prodcode,psl_prodcode,rs1.getString("bar_prodcode"));
 					if(!rs.next()) {
-						showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs1.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+						rs = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@WP where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%" + rs1.getString("bar_prodcode") + "%'", ma_code, ps_prodcode, psl_prodcode);
+						if (!rs.next()) {
+							showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs1.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+						}
 					}
 				}
 			}
@@ -805,12 +811,15 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					+" 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"));
 			if(!rs.next()){
 				rs = baseDao.queryForRowSet("select bo_mothercode,bd_soncode,pre_repcode from wp_replace_view@WP where bo_mothercode = ? and bd_soncode = ? and pre_repcode = ?",ps_prodcode,psl_prodcode,rs2.getString("bar_prodcode"));
-				if(!rs.next()){
-					rs = baseDao.queryForRowSet("select bd_mothercode,bd_soncode,prr_reprodcode from PRODUCTRELATION left join bomdetail on bd_id = prr_bdid where bd_mothercode = ? and bd_soncode = ? and prr_reprodcode = ?",ps_prodcode,psl_prodcode,rs2.getString("bar_prodcode"));
-					if(!rs.next()) {
-						showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs2.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
+				if(!rs.next()) {
+					rs = baseDao.queryForRowSet("select bd_mothercode,bd_soncode,prr_reprodcode from PRODUCTRELATION left join bomdetail on bd_id = prr_bdid where bd_mothercode = ? and bd_soncode = ? and prr_reprodcode = ?", ps_prodcode, psl_prodcode, rs2.getString("bar_prodcode"));
+					if (!rs.next()) {
+						rs = baseDao.queryForRowSet("select MM_MOTHERCODE,mm_prodcode,mm_repprodcode,mm_code from MakeMaterial@WP where mm_code = ? and MM_MOTHERCODE = ? and mm_prodcode = ? and mm_repprodcode like '%" + rs2.getString("bar_prodcode") + "%'", ma_code, ps_prodcode, psl_prodcode);
+						if(!rs.next()) {
+								showSmtError(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs2.getString("bar_prodcode") + "]不是该站位需要上料的物料", handleType, linecode, location, ps_prodcode, "料卷" + bar_code, bool, table);
 					}
 				}
+				}
 			}
 			pr_code = rs2.getString("bar_prodcode");
 			bar_remain = rs2.getDouble("bar_remain");

+ 4 - 6
src/com/uas/mes/pda/service/impl/PdaSpmServiceImpl.java

@@ -1,9 +1,6 @@
 package com.uas.mes.pda.service.impl;
 
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.uas.mes.common.data.BaseDao;
 import com.uas.mes.common.support.SystemSession;
 import com.uas.mes.core.data.SqlRowList;
@@ -12,9 +9,10 @@ import com.uas.mes.core.exception.APIErrorException.APIErrorCode;
 import com.uas.mes.core.util.NumberUtil;
 import com.uas.mes.core.util.StringUtil;
 import com.uas.mes.pda.service.PdaSpmService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -291,7 +289,7 @@ public  class PdaSpmServiceImpl implements PdaSpmService {
                 "where bar_code = '"+barcode+"' and nvl(bar_status,0) = 1");
         if(rs.next()){
             //3、条码必须是锡膏条码
-            if(!rs.getGeneralString("pr_kind3").equals("锡膏")){
+            if(!rs.getGeneralString("SPEC").contains("锡膏")){
                 throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码"+barcode+",非锡膏条码!");
             }
             //4、条码有效期校验
@@ -323,7 +321,7 @@ public  class PdaSpmServiceImpl implements PdaSpmService {
                 "where bar_code = '"+barcode+"' and nvl(bar_status,0) = 1");
         if(rs.next()){
             //3、条码必须是锡膏条码
-            if(!rs.getGeneralString("pr_kind3").equals("锡膏")){
+            if(!rs.getGeneralString("SPEC").contains("锡膏")){
                 throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"条码"+barcode+",非锡膏条码!");
             }
             //4、条码有效期校验