|
@@ -189,6 +189,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
Object dl_macode = map.get("DL_MACODE");
|
|
|
Object linecode= map.get("DL_LINECODE"),location = map1.get("dsl_location");
|
|
|
Object table = map.get("DL_TABLE");
|
|
|
+ Object fe_code = map1.get("dsl_fecode");
|
|
|
String type="barcode",ps_prodcode = null;
|
|
|
int has_make=0;
|
|
|
String handleType = "上料";
|
|
@@ -209,7 +210,23 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
if(rs.next()){
|
|
|
showSmtError(APIErrorCode.DATA_NOT_FOUND,"该站位已上料",handleType,linecode,location,ps_prodcode,"",bool,table);
|
|
|
}
|
|
|
-
|
|
|
+ rs=baseDao.queryForRowSet("select fe_code,fe_location,fe_barcode from feeder where fe_code='"+fe_code+"'");
|
|
|
+
|
|
|
+ if(rs.next()){
|
|
|
+ String fe_location=rs.getString("fe_location");
|
|
|
+ String fe_barcode=rs.getString("fe_barcode");
|
|
|
+ bar_code=rs.getString("fe_barcode");
|
|
|
+
|
|
|
+ if(fe_barcode == null || ("").equals(fe_barcode)){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达未绑定料盘");
|
|
|
+ }
|
|
|
+ if(!(fe_location == null || ("").equals(fe_location))){
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达已绑定站位"+fe_location);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
|
|
|
+ }
|
|
|
+
|
|
|
rs = baseDao.queryForRowSet("select bar_remain,nvl(bar_place,1)bar_place,bar_prodcode,bar_code from barcode where bar_code=? ",bar_code);
|
|
|
if(rs.next()){
|
|
|
rs1 = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
|
|
@@ -255,6 +272,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ baseDao.updateByCondition("feeder","fe_location='"+location+"'","fe_code='"+fe_code+"'");
|
|
|
double ma_qty=0;
|
|
|
rs = baseDao.queryForRowSet("select ma_qty from make where ma_id=?",map.get("MA_ID"));
|
|
|
if(rs.next()){
|
|
@@ -322,7 +341,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
* 确认下料
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> cuttingStock(String code ,String deviceLineMake) {
|
|
|
+ public List<Map<String, Object>> cuttingStock(String code ,String deviceLineMake,Integer Untying) {
|
|
|
Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
|
|
|
SqlRowList rs = null;
|
|
|
SqlRowList rsReturn = null;
|
|
@@ -348,7 +367,14 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
if(rsReturn.next()){
|
|
|
dsl_location = rsReturn.getString("dsl_location");
|
|
|
}else{
|
|
|
- showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+code+"]无上料数据,无需下料",handleType,linecode,"",pr_code,"",bool,table);
|
|
|
+
|
|
|
+ rs=baseDao.queryForRowSet("select fe_location from feeder where fe_code='"+code+"'");
|
|
|
+ if(rs.next()){
|
|
|
+ dsl_location=rs.getString("fe_location");
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+code+"]无上料数据,无需下料",handleType,linecode,"",pr_code,"",bool,table);
|
|
|
+ }
|
|
|
}
|
|
|
rsReturn = baseDao.queryForRowSet("select max(dsl_location) dsl_location,max(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id,max(dsl_barcode) dsl_barcode,max(dsl_fespec) dsl_fespec,max(dsl_prodcode) dsl_prodcode,wm_concat(nvl(dsl_barcode,dsl_prodcode)) dsl_return from devsmtlocation "
|
|
|
+ " where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_location =? and dsl_table =? ",linecode,map.get("DL_MACODE"),dsl_location,map.get("DL_TABLE"));
|
|
@@ -369,13 +395,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate"
|
|
|
+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+map.get("DL_TABLE")+"'");
|
|
|
- baseDao.execute(sqls);
|
|
|
|
|
|
rs = baseDao.queryForRowSet("select dl_macode,dl_hasmake from deviceline where dl_linecode =?",linecode);
|
|
|
int has_make=0;
|
|
|
if(rs.next()){
|
|
|
has_make=rs.getInt("dl_hasmake");
|
|
|
}
|
|
|
+
|
|
|
+ if(Untying==-1){
|
|
|
+ sqls.add("update feeder set fe_location='',fe_barcode='' where fe_location='"+dsl_location+"'");
|
|
|
+ }else {
|
|
|
+ sqls.add("update feeder set fe_location='' where fe_location='"+dsl_location+"'");
|
|
|
+ }
|
|
|
+ baseDao.execute(sqls);
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"下料","下料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+",料卷号或站位:"+code,linecode,dsl_location,0,pr_code,rsReturn.getString("dsl_return"),map.get("DL_TABLE"),has_make == -1?ma_code:"");
|
|
|
return rsReturn.getResultList();
|
|
|
}else{
|
|
@@ -390,7 +422,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void cuttingAllStock(String dl_macode,String dl_linecode,Integer dl_madeqty) {
|
|
|
+ public void cuttingAllStock(String dl_macode,String dl_linecode,Integer dl_madeqty,Integer Untying) {
|
|
|
SqlRowList rs = null;
|
|
|
int madeqty = 0;
|
|
|
String dl_table="",dl_devcode = "",dl_prodcode;
|
|
@@ -464,6 +496,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
|
|
|
sqls.add("update devsmtlocation set dsl_remainqty="+dsl_remainqty+" where dsl_id="+rs.getInt("dsl_id"));
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain="+dsl_remainqty+",bar_remain="+dsl_remainqty+" where bar_code='"+rs.getString("dsl_barcode")+"' and bar_place='"+dl_macode+"'");
|
|
|
+ if(Untying==-1){
|
|
|
+ sqls.add("update feeder set fe_location='',fe_barcode='' where fe_location='"+dsl_location+"'");
|
|
|
+ }else {
|
|
|
+ sqls.add("update feeder set fe_location='' where fe_location='"+dsl_location+"'");
|
|
|
+ }
|
|
|
}else{
|
|
|
|
|
|
if(actAddQty >0){
|
|
@@ -486,6 +523,12 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(Untying==-1){
|
|
|
+ sqls.add("update feeder set fe_location='',fe_barcode='' where fe_location='"+dsl_location+"'");
|
|
|
+ }else {
|
|
|
+ sqls.add("update feeder set fe_location='' where fe_location='"+dsl_location+"'");
|
|
|
+ }
|
|
|
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where bar_code in (select dsl_barcode from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 and dsl_location='"+rs.getString("dsl_location")+"' and dsl_id<>"+rs.getInt("dsl_id")+") and bar_place='"+dl_macode+"'");
|
|
|
|
|
@@ -694,6 +737,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
int has_make=0;
|
|
|
List<String> sqls = new ArrayList<String>();
|
|
|
Object bar_code = map1.get("dsl_barcode"),ma_code = map.get("DL_MACODE"),table = map.get("DL_TABLE");
|
|
|
+ Object dsl_fecode= map1.get("dsl_fecode");
|
|
|
Object location = map1.get("dsl_location"),linecode= map.get("DL_LINECODE");
|
|
|
|
|
|
rs=baseDao.queryForRowSet("select dl_macode,dl_statuscode,dl_hasmake,dl_prodcode from deviceline where dl_linecode=?",linecode);
|
|
@@ -1881,4 +1925,40 @@ 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{
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getFeederLocation(String fe_code) {
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ if(baseDao.checkIf("feeder","fe_code='"+fe_code+"'")){
|
|
|
+ map.put("fe_code",fe_code);
|
|
|
+ map.put("fe_location",baseDao.getFieldDataByCondition("feeder","fe_location","fe_code='"+fe_code+"'"));
|
|
|
+ }else{
|
|
|
+ throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|