|
|
@@ -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+"]无对应排位表");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|