|
|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
@@ -61,9 +62,9 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
*
|
|
|
*/
|
|
|
@Override
|
|
|
- public StepWorkApiResult<Map<String,Object>> test(String data) {
|
|
|
+ public StepWorkApiResult<Map<String,Object>> test(HttpServletRequest request ,String data) {
|
|
|
insertLogger(data,"test");
|
|
|
- return testmain(data);
|
|
|
+ return testmain(request,data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -77,9 +78,9 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public StepWorkApiResult<Map<String,Object>> station(String data) {
|
|
|
+ public StepWorkApiResult<Map<String,Object>> station(HttpServletRequest request , String data) {
|
|
|
insertLogger(data,"station");
|
|
|
- return stationmain(data);
|
|
|
+ return stationmain(request,data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -115,11 +116,11 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
|
|
|
private boolean stepPassed(String iMakeCode, String iSourceCode, String iSN, String iUserCode, String iResult) {
|
|
|
String msg = baseDao.callProcedure("CS_SETSTEPRESULT",
|
|
|
- String.valueOf(iMakeCode),
|
|
|
- String.valueOf(iSourceCode),
|
|
|
- String.valueOf(iSN),
|
|
|
- String.valueOf(iUserCode),
|
|
|
- String.valueOf(iResult));
|
|
|
+ iMakeCode,
|
|
|
+ iSourceCode,
|
|
|
+ iSN,
|
|
|
+ iUserCode,
|
|
|
+ iResult);
|
|
|
if(StringUtil.hasText(msg)){
|
|
|
throw new ApiStepWorkException(new StepWorkApiResult(false,400,msg));
|
|
|
}else{
|
|
|
@@ -153,7 +154,8 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
* "测试结果":"成功"
|
|
|
* }]}
|
|
|
*/
|
|
|
- private void saveTestDataAndPassed(String macode, String stepcode,String sccode, String sncode, String isok, String failureCode, Object isinput,Object machineTestData) {
|
|
|
+ private void saveTestDataAndPassed(String macode, String stepcode,String sccode, String sncode, String isok, String failureCode,
|
|
|
+ Object isinput,Object machineTestData,Object extendSequenceNumber,String usercode) {
|
|
|
//保存测试数据
|
|
|
Object machinecode = "";
|
|
|
List<Map<Object,Object>> sqldata = new ArrayList<>();
|
|
|
@@ -253,7 +255,12 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- stepPassed(macode,sccode,sncode,null,"PASS".equals(isok)?"OK":"NG");
|
|
|
+ //转号:CS_SNCHANGEANDBURN
|
|
|
+ if(StringUtil.hasText(extendSequenceNumber)){
|
|
|
+ snChange(macode,sccode,sncode,extendSequenceNumber.toString(),usercode);
|
|
|
+ }else {
|
|
|
+ stepPassed(macode, sccode, sncode, usercode, "PASS".equals(isok) ? "OK" : "NG");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//记录日志
|
|
|
@@ -263,7 +270,7 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public StepWorkApiResult<Map<String,Object>> testmain(String data){
|
|
|
+ public StepWorkApiResult<Map<String,Object>> testmain(HttpServletRequest request,String data){
|
|
|
Map<Object,Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
String macode = " ";
|
|
|
if(StringUtil.hasText(map.get("workOrderNo"))){//工单号可填写可不填
|
|
|
@@ -300,12 +307,14 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
throw new ApiStepWorkException(new StepWorkApiResult(false, 400, "测试不良代码:" + failureCode + "在MES系统不存在!"));
|
|
|
}
|
|
|
}
|
|
|
+ String usercode = String.valueOf(request.getSession().getAttribute("usercode"));
|
|
|
//工序校验
|
|
|
- Map<String,Object> remap = checkStep(macode,sccode.toString(),sncode.toString(),null);
|
|
|
+ Map<String,Object> remap = checkStep(macode,sccode.toString(),sncode.toString(),usercode);
|
|
|
if(Boolean.valueOf(remap.get("success").toString())){
|
|
|
//工序保存测试数据并且过站
|
|
|
saveTestDataAndPassed(remap.get("macode").toString(),stepcode.toString(),sccode.toString(),sncode.toString(),
|
|
|
- isok.toString(),failureCode.toString(),map.get("isinput"),map.get("machineTestData"));
|
|
|
+ isok.toString(),failureCode.toString(),map.get("isinput"),map.get("machineTestData"),
|
|
|
+ map.get("extendSequenceNumber"),usercode);
|
|
|
return StepWorkApiResponse.successRsp(200,"【"+sncode+"】产品序列号过站成功!");
|
|
|
}else{
|
|
|
return StepWorkApiResponse.failRsp(400,remap.get("msg").toString());
|
|
|
@@ -313,7 +322,7 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public StepWorkApiResult<Map<String,Object>> stationmain(String data) {
|
|
|
+ public StepWorkApiResult<Map<String,Object>> stationmain(HttpServletRequest request ,String data) {
|
|
|
Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
String macode = " ";
|
|
|
if (StringUtil.hasText(map.get("workOrderNo"))) {//工单号可填写可不填
|
|
|
@@ -331,15 +340,30 @@ public class StepWorkServiceImpl implements StepWorkService {
|
|
|
if (!StringUtil.hasText(sncode)) {
|
|
|
return StepWorkApiResponse.failRsp(400, "产品SN(sequenceNumber)不能为空!");
|
|
|
}
|
|
|
- Map<String, Object> remap = checkStep(macode, sccode.toString(), sncode.toString(), null);
|
|
|
+ String usercode = String.valueOf(request.getSession().getAttribute("usercode"));
|
|
|
+ Map<String, Object> remap = checkStep(macode, sccode.toString(), sncode.toString(), usercode);
|
|
|
if (Boolean.valueOf(remap.get("success").toString())) {
|
|
|
- stepPassed(remap.get("macode").toString(), sccode.toString(), sncode.toString(), null, "OK");
|
|
|
+ stepPassed(remap.get("macode").toString(), sccode.toString(), sncode.toString(), usercode, "OK");
|
|
|
return StepWorkApiResponse.successRsp(200, "【" + sncode + "】产品序列号过站成功!");
|
|
|
} else {
|
|
|
return StepWorkApiResponse.failRsp(400, remap.get("msg").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private boolean snChange(String iMakeCode, String iSourceCode, String tsn,String iSN, String iUserCode) {
|
|
|
+ //v_i_ifrechange in number default 0,-- 标识是否重复转号 0否,1是
|
|
|
+ String msg = baseDao.callProcedure("CS_SNCHANGEANDBURN",
|
|
|
+ tsn,iSN,iSourceCode,iUserCode,iMakeCode,0,
|
|
|
+ null,null,null,null,null,
|
|
|
+ iSN,null,null,null,null,null,null,null,null
|
|
|
+ );
|
|
|
+ if(StringUtil.hasText(msg)){
|
|
|
+ throw new ApiStepWorkException(new StepWorkApiResult(false,400,msg));
|
|
|
+ }else{
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/* SqlRowList rs=baseDao.queryForRowSet("select nvl(st_ifinput,0)st_ifinput,nvl(st_ifoqc,0)st_ifoqc,nvl(st_ifweigh,0)st_ifweigh from "+Master+".source left join "+Master+".step on sc_stepcode=st_code where sc_code='"+iResCode+"'");
|
|
|
if(rs.next()){
|
|
|
String st_ifinput=rs.getString("st_ifinput");
|