Browse Source

【英唐精密MES】【新增备料料卷查询界面】

caosy 6 years ago
parent
commit
f9ba2814cc

+ 9 - 0
src/com/uas/mes/api/pda/PdaSMTController.java

@@ -303,4 +303,13 @@ public class PdaSMTController extends BaseApiController{
 	public ModelMap barcodeGetLocation(String barcode,String devicelineinfo){
 		return success(pdaSMTService.barcodeGetLocation(barcode,devicelineinfo));
 	}
+
+
+	/**
+	 SMT-根据条码号获取站位,备料使用
+	 */
+	@RequestMapping(value="/prebarcodeGetLocation.action")
+	public ModelMap prebarcodeGetLocation(String barcode,String linecode,String makecode,String table){
+		return success(pdaSMTService.prebarcodeGetLocation(barcode, linecode,makecode,table));
+	}
 }

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

@@ -65,4 +65,6 @@ public interface PdaSMTService {
 	void updateMakePrepare(String id);
 
 	Map<String, Object> barcodeGetLocation(String barcode,String devicelineinfo);
+
+	Map<String, Object> prebarcodeGetLocation(String barcode,String linecode,String makecode,String table);
 }

+ 58 - 0
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -1882,4 +1882,62 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					}
 				}
 		}
+
+	@Override
+	public Map<String, Object> prebarcodeGetLocation(String barcode, String linecode, String makecode, String table) {
+		Map<String, Object> location = new HashMap<String, Object>();
+		SqlRowList rr = baseDao.queryForRowSet("select ma_prodcode from make where ma_code = ?",makecode);
+		Object ps_prodcode;
+		if (rr.next())
+		{
+			 ps_prodcode = rr.getString("ma_prodcode");
+		}else {
+			throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "工单["+makecode+"]错误,不存在");
+		}
+
+		String pr_code = "";
+		SqlRowList rs = baseDao.queryForRowSet("select bar_status,bar_prodcode,pr_detail,pr_spec,bar_batchcode,bar_whcode,bar_remain,bar_vendcode "
+				+ "from barcode left join product on pr_code=bar_prodcode where bar_code=?", barcode);
+		if (rs.next()) {
+			SqlRowList ra = baseDao.queryForRowSet("select NVL(WM_CONCAT(PSL_LOCATION),' ') PSL_LOCATION  from productsmtlocation left join productsmt on ps_id = psl_psid  where ps_linecode = ? and ps_prodcode = ? and (psl_prodcode=? or psl_repcode=?) and psl_table=?", linecode, ps_prodcode, rs.getString("bar_prodcode"), rs.getString("bar_prodcode"), table);
+			ra.next();
+			if (" ".equals(ra.getString("PSL_LOCATION")))
+				throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + rs.getString("bar_prodcode") + "]不是当前线别需要上料的物料");
+			else {
+				location.put("location", ra.getString("PSL_LOCATION"));
+				return location;
+			}
+		} else {
+			rs = baseDao.queryForRowSet("select psl_prodcode,wm_concat(psl_repcode)repcode from productsmtlocation left join productsmt on ps_id = psl_psid  where ps_linecode = ? and ps_prodcode = ?  and psl_table=? group by psl_prodcode",linecode,ps_prodcode,table);
+			if(rs.next()){
+				for(Map<String ,Object> mapnow:rs.getResultList()) {
+					if (barcode.toString().contains(mapnow.get("psl_prodcode").toString())) {
+						pr_code =mapnow.get("psl_prodcode").toString();
+					} else {try {
+						String[] stringArr = mapnow.get("repcode").toString().split(",");
+						for (String s : stringArr) {
+							if (barcode.toString().contains(s)) {
+								pr_code = s;
+							}
+						}
+					}catch(Exception e){}
+					}
+				}
+				if(pr_code == null || ("").equals(pr_code)){
+					throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "料卷["+barcode+"]不是该机台需要上料的料卷");
+				}
+
+				SqlRowList ra = baseDao.queryForRowSet("select NVL(WM_CONCAT(PSL_LOCATION),' ') PSL_LOCATION  from productsmtlocation left join productsmt on ps_id = psl_psid  where ps_linecode = ? and ps_prodcode = ? and (psl_prodcode=? or psl_repcode=?) and psl_table=?", linecode, ps_prodcode, pr_code,pr_code, table);
+				ra.next();
+				if (" ".equals(ra.getString("PSL_LOCATION")))
+					throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "料卷对应的物料[" + pr_code + "]不是当前机台需要上料的物料");
+				else {
+					location.put("location", ra.getString("PSL_LOCATION"));
+					return location;
+				}
+			}else {
+				throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "线别["+linecode+"],产品["+ps_prodcode+"],版面["+table+"]无对应排位表");
+			}
+		}
+	}
 }