|
|
@@ -1,17 +1,5 @@
|
|
|
package com.uas.mes.pm.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import org.apache.log4j.Logger;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.uas.mes.common.data.BaseDao;
|
|
|
import com.uas.mes.common.data.SqlUtil;
|
|
|
@@ -20,16 +8,19 @@ import com.uas.mes.common.util.BaseUtil;
|
|
|
import com.uas.mes.core.data.SqlRowList;
|
|
|
import com.uas.mes.core.exception.SystemException;
|
|
|
import com.uas.mes.core.support.StateAssert;
|
|
|
-import com.uas.mes.core.util.CollectionUtil;
|
|
|
-import com.uas.mes.core.util.FlexJsonUtil;
|
|
|
-import com.uas.mes.core.util.HttpUtil;
|
|
|
+import com.uas.mes.core.util.*;
|
|
|
import com.uas.mes.core.util.HttpUtil.Response;
|
|
|
-import com.uas.mes.core.util.NumberUtil;
|
|
|
-import com.uas.mes.core.util.StringUtil;
|
|
|
import com.uas.mes.pda.dao.PdaCommonDao;
|
|
|
import com.uas.mes.pm.dao.MakeCraftDao;
|
|
|
import com.uas.mes.pm.model.Makepreparedetail;
|
|
|
import com.uas.mes.pm.service.MakePrepareService;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service("makePrepareService")
|
|
|
public class MakePrepareServiceImpl implements MakePrepareService {
|
|
|
@@ -419,7 +410,8 @@ public class MakePrepareServiceImpl implements MakePrepareService {
|
|
|
// 记录操作
|
|
|
baseDao.logger.submit(caller, "mp_id", id);
|
|
|
if(caller.equals("MakePrepare2") && baseDao.isDBSetting("MakePrepare2", "autoGetMakePrepareBarcode")){//新工单备料 提交自动请求备料信息
|
|
|
- getMakePrepareBarcode(id);
|
|
|
+ getMakePrepareBarcode(id,1);
|
|
|
+ getMakePrepareBarcode(id,2);
|
|
|
}
|
|
|
// 执行提交后的其它逻辑
|
|
|
handlerService.afterSubmit(caller, new Object[] { id });
|
|
|
@@ -606,7 +598,7 @@ public class MakePrepareServiceImpl implements MakePrepareService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void getMakePrepareBarcode(int id) {
|
|
|
+ public void getMakePrepareBarcode(int id,int times) {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select mp_code,mp_id from MakePrepare where nvl(mp_pstatus,' ') = '待取料'");
|
|
|
if(rs.next()){
|
|
|
BaseUtil.showErrorOnSuccess("备料单:["+rs.getGeneralString("mp_code")+"],状态为待取料请优先处理!");
|
|
|
@@ -629,9 +621,17 @@ public class MakePrepareServiceImpl implements MakePrepareService {
|
|
|
}
|
|
|
Object lineCode = mpMsg[1];
|
|
|
Object mpCode = mpMsg[0];
|
|
|
- //备料信息整合
|
|
|
- List<Makepreparedetail> matList = baseDao.getJdbcTemplate().query("select MD_PRODCODE partNumber,MD_NEEDQTY quantity,'"+lineCode+"' productLine,MD_LOCATION feederLocation "
|
|
|
- + "from makePreparedetail where md_barcode is null and md_mpid = "+id,new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
|
|
|
+ List<Makepreparedetail> matList =null;
|
|
|
+ if (times==1) {
|
|
|
+ //备料信息整合
|
|
|
+ matList = baseDao.getJdbcTemplate().query("select MD_PRODCODE partNumber,MD_NEEDQTY quantity,'" + lineCode + "' productLine,MD_LOCATION feederLocation "
|
|
|
+ + "from makePreparedetail where md_barcode is null and md_mpid = " + id, new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
|
|
|
+ }else {
|
|
|
+ //备料信息整合
|
|
|
+ matList = baseDao.getJdbcTemplate().query("select max(md_repcode) partNumber,MD_NEEDQTY quantity,'" + lineCode + "' productLine,MD_LOCATION feederLocation " +
|
|
|
+ "from makePreparedetail where md_barcode is null and md_prodcode <> md_repcode and md_mpid = " + id + " group by MD_NEEDQTY,MD_LOCATION", new BeanPropertyRowMapper<Makepreparedetail>(Makepreparedetail.class));
|
|
|
+ }
|
|
|
+
|
|
|
if(!CollectionUtil.isEmpty(matList)){
|
|
|
mpMap.put("send", isProd);
|
|
|
mpMap.put("user", "system");
|
|
|
@@ -675,7 +675,7 @@ public class MakePrepareServiceImpl implements MakePrepareService {
|
|
|
"MD_BARCODE = (case when MD_BARCODE is null then '"+map.get("uid")+"|' else MD_BARCODE||'"+map.get("uid")+"|' end), " +
|
|
|
" md_qty = nvl(md_qty,0) + "+map.get("qty")+", " +
|
|
|
"MD_SHELFID = (case when MD_SHELFID is null then '"+map.get("shelfid")+"|' else MD_SHELFID||'"+map.get("shelfid")+"|' end)"
|
|
|
- + "where MD_PRODCODE = '"+map.get("matid")+"' and MD_LOCATION ='"+map.get("feederLocation")+"' and md_mpid = "+id);
|
|
|
+ + "where md_repcode = '"+map.get("matid")+"' and MD_LOCATION ='"+map.get("feederLocation")+"' and md_mpid = "+id);
|
|
|
sqls.add("insert into MakePrepareDetaildet (MDD_ID,MDD_MPID,MDD_PRODCODE,MDD_LOCATION,MDD_BARCODE,MDD_QTY,MD_SHELFID) " +
|
|
|
"values (MAKEPREPAREDETAILDET_SEQ.nextval,"+id+",'"+map.get("matid")+"','"+map.get("feederLocation")+"','"+map.get("uid")+"',"+map.get("qty")+",'"+map.get("shelfid")+"')");
|
|
|
//sqls.add("update barcode set bar_place='"+mpCode+"' where bar_code='" + map.get("uid") + "'");
|