|
@@ -218,7 +218,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
bar_code=rs.getString("fe_barcode");
|
|
|
|
|
|
if(fe_barcode == null || ("").equals(fe_barcode)){
|
|
|
- throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达未绑定料盘");
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"未绑定料盘");
|
|
|
}
|
|
|
if(!(fe_location == null || ("").equals(fe_location))){
|
|
|
throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达已绑定站位"+fe_location);
|
|
@@ -1929,24 +1929,32 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
@Override
|
|
|
public Map<String, Object> bindFeederBarcode(String barcode,String fe_code) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- if(baseDao.checkIf("feeder","fe_code='"+fe_code+"'")){
|
|
|
- SqlRowList rs = baseDao.queryForRowSet("select bar_remain,nvl(bar_place,1)bar_place,bar_prodcode,bar_code from barcode where bar_code=? ",barcode);
|
|
|
- if(rs.next()){
|
|
|
- if(rs.getDouble("bar_remain") <= 0){
|
|
|
- throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND,"料卷号数量必须大于0");
|
|
|
- }else if(!"1".equals(rs.getString("bar_place"))){
|
|
|
- throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND,"料卷已被单据["+rs.getString("bar_place")+"]使用");
|
|
|
- }
|
|
|
- baseDao.updateByCondition("feeder","fe_barcode='"+barcode+"'","fe_code='"+fe_code+"'");
|
|
|
- map.put("barcode",barcode);
|
|
|
- map.put("fe_code",fe_code);
|
|
|
- }else
|
|
|
- {
|
|
|
- throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "料卷"+barcode+"不存在");
|
|
|
- }
|
|
|
- }else{
|
|
|
+ SqlRowList rs=baseDao.queryForRowSet("select fe_location,fe_barcode from feeder where fe_code='"+fe_code+"'");
|
|
|
+ if(!rs.next()){
|
|
|
throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
|
|
|
}
|
|
|
+ String fe_location=rs.getString("fe_location");
|
|
|
+
|
|
|
+ if(fe_location!=null&&!fe_location.equals("")) {
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"已上站位"+fe_location+",需要绑定料盘请先下料");
|
|
|
+ }
|
|
|
+
|
|
|
+ Object fecode=baseDao.getFieldDataByCondition("feeder","fe_code","fe_barcode='"+barcode+"'");
|
|
|
+ if(fecode!=null){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "条码"+barcode+"已绑定飞达"+fecode+"");
|
|
|
+ }
|
|
|
+ rs = baseDao.queryForRowSet("select bar_remain,nvl(bar_place,1)bar_place,bar_prodcode,bar_code from barcode where bar_code=? ",barcode);
|
|
|
+ if(!rs.next()){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "料卷"+barcode+"不存在");
|
|
|
+ }
|
|
|
+ if(rs.getDouble("bar_remain") <= 0){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND,"料卷号数量必须大于0");
|
|
|
+ }else if(!"1".equals(rs.getString("bar_place"))){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND,"料卷已被单据["+rs.getString("bar_place")+"]使用");
|
|
|
+ }
|
|
|
+ baseDao.updateByCondition("feeder","fe_barcode='"+barcode+"'","fe_code='"+fe_code+"'");
|
|
|
+ map.put("barcode",barcode);
|
|
|
+ map.put("fe_code",fe_code);
|
|
|
return map;
|
|
|
}
|
|
|
|