Преглед изворни кода

[行之成EIS] MES增加摆盘物料上料接口

caosy пре 2 месеци
родитељ
комит
06e96faec8

+ 2 - 1
src/main/java/com/uas/eis/entity/HelperType.java

@@ -19,7 +19,8 @@ public enum HelperType {
     SetPcbaData("SetPcbaData","检测XXX") ,//设置测试结果
     GoMo("GoMo","检测XXX") ,//序列号归属工单
     GetInfoByMaterial("GetInfoByMaterial","根据上料信息获取到SN相关信息"),
-    GetMakeInfoBySN("GetMakeInfoBySN","根据SN获取工单相关信息");
+    GetMakeInfoBySN("GetMakeInfoBySN","根据SN获取工单相关信息"),
+    SetBpMaterial("SetBpMaterial","自动线摆盘物料上到SN");
 
     private String code;
     private String name;

+ 74 - 2
src/main/java/com/uas/eis/serviceImpl/MESHelperServiceImpl.java

@@ -814,6 +814,9 @@ public class MESHelperServiceImpl implements MESHelperService {
 			case GetMakeInfoBySN:
 				remap = GetMakeInfoBySN(json);
 				break;
+			case SetBpMaterial:
+				remap = SetBpMaterial(json);
+				break;
 			default:
 				err = -1;
 				break;
@@ -1374,8 +1377,8 @@ public class MESHelperServiceImpl implements MESHelperService {
 		String iResult = null;
 		String flag = null;
 		String iErrCode = null;
-		if(map.get("iSourceCode")!=null){
-			iSourceCode=map.get("iSourceCode").toString();
+		if(map.get("iResCode")!=null){
+			iSourceCode=map.get("iResCode").toString();
 		}
 		if(map.get("iOperater")!=null){
 			iOperater=map.get("iOperater").toString();
@@ -1535,6 +1538,7 @@ public class MESHelperServiceImpl implements MESHelperService {
 		if(map.get("iErrCode")!=null){
 			iErrCode=map.get("iErrCode").toString();
 		}
+
 		JSONObject map3=new JSONObject();
 		map3.put("iSN",iSN);
 		Map<Object, Object> map2=GetRcardMOInfo(map3);
@@ -1875,4 +1879,72 @@ public class MESHelperServiceImpl implements MESHelperService {
 		return rmap;
 	}
 
+
+	private Map<Object,Object> SetBpMaterial(JSONObject map)
+	{
+		Map<Object, Object> rmap = new HashMap<Object, Object>();
+		String iSN=null;
+		String oErrMessage=null;
+		String iZJ=null;
+		String iResCode = null;
+		String linecode = null;
+		String stepcode =  null;
+		if(map.get("iSN")==null){
+			oErrMessage = "SN不能为空";
+			rmap.put("oErrMessage",oErrMessage);
+			return rmap;
+		}
+		if(map.get("iZJ")==null){
+			oErrMessage = "载具号不能为空";
+			rmap.put("oErrMessage",oErrMessage);
+			return rmap;
+		}
+		iSN=map.get("iSN").toString();
+		iZJ=map.get("iZJ").toString();
+		iResCode=map.get("iResCode").toString();
+		linecode = GetlineCodeBySource(iResCode);
+		stepcode = GetStepCodeBySource(iResCode);
+
+		JSONObject map3=new JSONObject();
+		map3.put("iSN",iSN);
+		Map<Object, Object> map2=GetRcardMOInfo(map3);
+		String oMoCode=null;
+		if(map2.get("oMoCode")!=null){
+			oMoCode=map2.get("oMoCode").toString();
+		}
+		if(!baseDao.checkIf("BEFOREHANDPROCESS","bhp_maincode = '"+iZJ+"' and nvl(BHP_STATUS,0) = 0"))
+		{
+			oErrMessage = "载具号"+iZJ+"内无材料";
+			rmap.put("oErrMessage",oErrMessage);
+			return rmap;
+		}
+
+		baseDao.execute("update Craftmaterial set cm_status = -1 where cm_sncode = '"+iSN+"' and cm_makecode = '"+oMoCode+"'");
+
+		baseDao.execute("insert into Craftmaterial (cm_id ,cm_makecode,cm_maid,cm_maprodcode, cm_soncode, cm_mscode, cm_sncode, cm_stepcode, cm_stepname,cm_fsoncode," +
+				" cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate,cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn) " +
+				" select Craftmaterial_seq.nextval,ma_code, ma_id, ma_prodcode,sp_soncode,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,sp_fsoncode," +
+				"  ms_craftcode,ms_craftname,bhp_barcode,1,sysdate,'','" + linecode +"',ma_wccode,'" + iResCode + "',sp_id,0,1,ms_firstsn" +
+				" from make left join makecraftdetail on mcd_macode=ma_code left join stepproduct on sp_stepcode=mcd_stepcode and sp_mothercode = ma_prodcode left join" +
+				"  makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode left join (select * from " +
+				"  BEFOREHANDPROCESS where bhp_maincode='" + iZJ + "' and nvl(bhp_status,0) =0 ) on sp_fsoncode=bhp_prodcode" +
+				"  where ma_code='" + oMoCode + "' and mcd_stepcode = '" + stepcode + "' and ms_sncode='" + iSN + "' and bhp_barcode is not null ");
+
+
+		baseDao.execute(" update BEFOREHANDPROCESS set bhp_status = -1 where bhp_maincode = '"+iZJ+"' and nvl(bhp_status,0) =0   ");
+
+
+		return SetStepFinish(oMoCode, iResCode, iSN, "", "OK", "ADMIN", "");
+	}
+
+
+	private String GetlineCodeBySource(String Source)
+	{
+		Object o=baseDao.getFieldDataByCondition("source", "sc_linecode", "sc_code='" + Source + "'");
+		if(o!=null)
+			return o.toString();
+		else
+			return "";
+	}
+
 }