|
|
@@ -685,9 +685,504 @@ public class MesProductRecordController extends BaseController {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ // 独立接口:创建订单报文
|
|
|
+ @PostMapping(value = "createOrder")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp createOrderApi(HttpServletRequest request) {
|
|
|
+ CommonResp<Object> resp = new CommonResp<>();
|
|
|
+
|
|
|
+ mesLogService.apisave(request);
|
|
|
+ String ret = "";
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ String userCode = request.getParameter("ucode");
|
|
|
+ String result = request.getParameter("result");
|
|
|
+ String oldOprno = oprno;
|
|
|
+ if (oldOprno.length() == 5) {
|
|
|
+ oprno += "A";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(sn)) {
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ MesLineProcess mesLineProcess1 = mesLineProcessService.getOnLineOprno(lineSn);
|
|
|
+ if (ObjectUtils.isEmpty(mesLineProcess1)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("OL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!CommonUitl.formatOprno(oprno).equals(mesLineProcess1.getOprno())) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("OM", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!result.equals("OK") && !result.equals("NG")) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("RM", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ String cateSn = mesLineService.findInfoCate(lineSn);
|
|
|
+ if (StringUtils.isEmpty(cateSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("CM", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!mesProductCateService.checkSn(sn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("GS", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!mesProcessCheckRecordService.checkRecord(oprno, lineSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("DJ", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ MesProductRecord mpr = mesProductRecordService.findBySnCate(sn, cateSn);
|
|
|
+ if (!ObjectUtils.isEmpty(mpr)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("CF", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ MesProductRecord mesProductRecord = new MesProductRecord();
|
|
|
+ mesProductRecord.setSn(sn);
|
|
|
+ mesProductRecord.setOprno(oprno);
|
|
|
+ mesProductRecord.setLineSn(lineSn);
|
|
|
+ mesProductRecord.setContent(result);
|
|
|
+ mesProductRecord.setCreateBy(userCode);
|
|
|
+ mesProductRecord.setCateSn(cateSn);
|
|
|
+
|
|
|
+ List<ParamsResp> params = mesProductRecordService.getQualityParam(oprno, lineSn,result);
|
|
|
+ ParamsResp paramsResp2 = new ParamsResp();
|
|
|
+ paramsResp2.setCraft("100000");
|
|
|
+ paramsResp2.setResult("OK");
|
|
|
+ params.add(paramsResp2);
|
|
|
+ try {
|
|
|
+ List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
|
|
|
+ if (!ListUtils.isEmpty(bmlists)) {
|
|
|
+ for (BindMaterialResp bindMaterialResp : bmlists) {
|
|
|
+ if (StringUtils.isEmpty(bindMaterialResp.getBatchSn())) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("BM", "RS"));
|
|
|
+ return resp;
|
|
|
+
|
|
|
+ }
|
|
|
+ Integer lastTimes = Integer.valueOf(bindMaterialResp.getLastTimes());
|
|
|
+ if (lastTimes < 1) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("BM", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ ParamsResp paramsRespm = new ParamsResp();
|
|
|
+ paramsRespm.setCraft(bindMaterialResp.getCraft());
|
|
|
+ paramsRespm.setResult("OK");
|
|
|
+ paramsRespm.setVal(bindMaterialResp.getBatchSn());
|
|
|
+ params.add(paramsRespm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ret = mesProductRecordService.add(mesProductRecord, params, bmlists);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();//RSNS
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ resp.setData("RSNS");
|
|
|
+ return resp;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData(ret);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:工位开始工作报文
|
|
|
+ @PostMapping(value = "startWork")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp startWorkApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String productCate = request.getParameter("lineSn");
|
|
|
+ String ucode = request.getParameter("ucode");
|
|
|
+ if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(productCate)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ MesDeviceTime mesDeviceTime = new MesDeviceTime();
|
|
|
+ mesDeviceTime.setOprno(oprno);
|
|
|
+ mesDeviceTime.setSn(sn);
|
|
|
+ mesDeviceTime.setStartDate(new Date());
|
|
|
+ mesDeviceTime.setProductCate(productCate);
|
|
|
+ mesDeviceTime.setCreateBy(ucode);
|
|
|
+ mesDeviceTime.setUpdateBy(ucode);
|
|
|
+ String ret = "RSNS";
|
|
|
+ try {
|
|
|
+ ret = mesDeviceTimeService.add(mesDeviceTime);
|
|
|
+ } catch (Exception e) {
|
|
|
+ ret = "RSNS";
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData(ret);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:绑定报文
|
|
|
+ @PostMapping(value = "bindRecord")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp bindRecordApi(HttpServletRequest request) {
|
|
|
+ CommonResp<Object> resp = new CommonResp<>();
|
|
|
+
|
|
|
+ String ret = "RSNS";
|
|
|
+
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String craft = request.getParameter("craft").trim();
|
|
|
+ String sn = request.getParameter("sn").trim();
|
|
|
+ String materielSn = request.getParameter("materielSn").trim();
|
|
|
+ String userCode = request.getParameter("userCode").trim();
|
|
|
+ String lineSn = request.getParameter("lineSn").trim();
|
|
|
+ if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(sn)
|
|
|
+ || StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(materielSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String fOprno = CommonUitl.formatOprno(oprno);
|
|
|
+ List<MesTemplateItems> mesTemplateItemsList = mesTemplateItemsService.findListByOprno(fOprno);
|
|
|
+ List<MesProductRecord> mesProductRecordList = mesProductRecordService.findBySnAndOprnoLike(sn, fOprno);
|
|
|
+ if (!ListUtils.isEmpty(mesTemplateItemsList)) {
|
|
|
+ Set<String> existCrafts = new HashSet<>();
|
|
|
+ if (!ListUtils.isEmpty(mesProductRecordList)) {
|
|
|
+ for (MesProductRecord record : mesProductRecordList) {
|
|
|
+ existCrafts.add(record.getCraft());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<MesTemplateItems> missingItems = new ArrayList<>();
|
|
|
+ for (MesTemplateItems templateItem : mesTemplateItemsList) {
|
|
|
+ if (!existCrafts.contains(templateItem.getCraft())) {
|
|
|
+ missingItems.add(templateItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(missingItems)) {
|
|
|
+ logger.warn("产品SN:{}, 工位:{}, 缺失模板项数量:{}", sn, fOprno, missingItems.size());
|
|
|
+ MesProduct mesProduct = mesProductService.findBySn(sn);
|
|
|
+ if (ObjectUtils.isEmpty(mesProduct)) {
|
|
|
+ throw new ServiceException(text("产品不存在!"));
|
|
|
+ }
|
|
|
+ Long cdate = Long.valueOf(CommonUitl.Date2TimeStamp(new Date()));
|
|
|
+ List<MesProductRecord> recordsToAdd = new ArrayList<>();
|
|
|
+ int maxSerial = 0;
|
|
|
+ if (!ListUtils.isEmpty(mesProductRecordList)) {
|
|
|
+ for (MesProductRecord record : mesProductRecordList) {
|
|
|
+ if (record.getSerial() != null && record.getSerial() > maxSerial) {
|
|
|
+ maxSerial = record.getSerial();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (MesTemplateItems missingItem : missingItems) {
|
|
|
+ MesProductRecord newRecord = new MesProductRecord();
|
|
|
+ newRecord.setSn(sn);
|
|
|
+ newRecord.setPid("0");
|
|
|
+ newRecord.setCateSn(mesProduct.getCate());
|
|
|
+ newRecord.setLineSn(lineSn);
|
|
|
+ newRecord.setCraft(missingItem.getCraft());
|
|
|
+ newRecord.setOprno(missingItem.getOprno());
|
|
|
+ newRecord.setSerial(maxSerial);
|
|
|
+ newRecord.setTid(missingItem.getId());
|
|
|
+ newRecord.setTreeLevel(0);
|
|
|
+ newRecord.setCdate(cdate);
|
|
|
+ newRecord.setContent("UDF");
|
|
|
+ newRecord.setSource("0");
|
|
|
+ newRecord.setCreateDate(new Date());
|
|
|
+ newRecord.setUpdateDate(new Date());
|
|
|
+ recordsToAdd.add(newRecord);
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(recordsToAdd)) {
|
|
|
+ mesProductRecordService.insertBatch(recordsToAdd, recordsToAdd.size());
|
|
|
+ logger.info("产品SN:{}, 补充创建记录数量:{}", sn, recordsToAdd.size());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mesProductRecordService.updateRecord(sn, oprno, craft, materielSn, "OK", userCode, lineSn);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData(ret);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:解绑报文
|
|
|
+ @PostMapping(value = "unbindRecord")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp unbindRecordApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String craft = request.getParameter("craft");
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String materielSn = request.getParameter("materielSn");
|
|
|
+ String userCode = request.getParameter("userCode");
|
|
|
+ String cateSn = request.getParameter("lineSn");
|
|
|
+ if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(sn)
|
|
|
+ || StringUtils.isEmpty(cateSn) || StringUtils.isEmpty(materielSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ mesProductRecordService.updateRecord(sn, oprno, craft, materielSn, "UDF", userCode, cateSn);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData("RSOK");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:查询质量报文
|
|
|
+ @PostMapping(value = "checkQualityMsg")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp checkQualityMsgApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String oldOprno = oprno;
|
|
|
+ if (oldOprno.length() == 5) {
|
|
|
+ oldOprno += "A";
|
|
|
+ }
|
|
|
+ oprno = CommonUitl.formatOprno(oprno);
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(oprno)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ String userCode = request.getParameter("userCode");
|
|
|
+ String ret = checkQualityCommon(oldOprno, sn, lineSn, userCode);
|
|
|
+
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData("RS" + ret.substring(3, 5));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:上传质量结果报文
|
|
|
+ @PostMapping(value = "updateQualityMsg")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp updateQualityMsgApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+
|
|
|
+ String craft = request.getParameter("craft");
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String result = request.getParameter("result");
|
|
|
+ String userCode = request.getParameter("userCode");
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(lineSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (oprno.length() == 5) {
|
|
|
+ oprno = oprno + "A";
|
|
|
+ }
|
|
|
+ MesLineProcess mesLineProcess1 = mesLineProcessService.findInfoByOprnoLineSn(oprno, lineSn);
|
|
|
+ if (ObjectUtils.isEmpty(mesLineProcess1)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("OI", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!mesLineProcess1.getType().equals("3") && StringUtils.isEmpty(sn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("SN", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (!result.equals("OK") && !result.equals("NG")) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("RO", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if (!craft.equals("100000")) {
|
|
|
+ mesProductRecordService.updateRecord(sn, oprno, craft, "", result, userCode, lineSn);
|
|
|
+ } else {
|
|
|
+ List<ParamsResp> params = mesProductRecordService.getQualityParam(oprno, lineSn,result);
|
|
|
+ logger.info("params:" + JSON.toJSONString(params));
|
|
|
+
|
|
|
+ String ret = updateQualityCommon(mesLineProcess1, oprno, lineSn, sn, craft, result, userCode, params);
|
|
|
+ resp.setData(ret);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData("RSOK");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:上传设备状态报文
|
|
|
+ @PostMapping(value = "deviceState")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp deviceStateApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+
|
|
|
+ String ret = "";
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String state = request.getParameter("state").trim();
|
|
|
+ String deviceContent = request.getParameter("deviceContent");
|
|
|
+ String productCate = request.getParameter("productCate");
|
|
|
+ Integer paramsNums = Integer.parseInt(request.getParameter("paramsNums"));
|
|
|
+ String errorCode = request.getParameter("errorCode").trim();
|
|
|
+ try {
|
|
|
+ if (paramsNums > 0) {
|
|
|
+ for (int j = 1; j <= paramsNums; j++) {
|
|
|
+ //String params = ProtocolParam.getParam(msg, j);
|
|
|
+ // 不再使用报文解析,直接接收故障代码参数
|
|
|
+ MesDeviceState mesDeviceState = new MesDeviceState();
|
|
|
+ mesDeviceState.setDeviceSn(oprno);
|
|
|
+ mesDeviceState.setCode(errorCode);
|
|
|
+ mesDeviceState.setState(String.valueOf(Integer.parseInt(state)));
|
|
|
+ mesDeviceState.setContent(deviceContent);
|
|
|
+ mesDeviceState.setStartDate(new Date());
|
|
|
+ mesDeviceState.setProductCate(productCate);
|
|
|
+ mesDeviceStateService.updateState(mesDeviceState);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ MesDeviceState mesDeviceState = new MesDeviceState();
|
|
|
+ mesDeviceState.setDeviceSn(oprno);
|
|
|
+ mesDeviceState.setCode("");
|
|
|
+ mesDeviceState.setState(state);
|
|
|
+ mesDeviceState.setContent(deviceContent);
|
|
|
+ mesDeviceState.setStartDate(new Date());
|
|
|
+ mesDeviceState.setProductCate(productCate);
|
|
|
+ mesDeviceStateService.updateState(mesDeviceState);
|
|
|
+ }
|
|
|
+ MesDevice mesDevice = mesDeviceService.findInfoBySnCate(oprno, productCate);
|
|
|
+ if (!ObjectUtils.isEmpty(mesDevice)) {
|
|
|
+ mesDevice.setWorkStatus(String.valueOf(Integer.parseInt(state)));
|
|
|
+ Date date = new Date();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String dateString = sdf.format(date);
|
|
|
+ mesDevice.setWorkTime(dateString);
|
|
|
+ mesDeviceService.update(mesDevice);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(state)) {
|
|
|
+ state = "RS";
|
|
|
+ }
|
|
|
+ ret = state + "OK";
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData(ret);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:上传参数报文
|
|
|
+ @PostMapping(value = "updateParams")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp updateParamsApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+ String msg = request.getParameter("msg");
|
|
|
+
|
|
|
+ String result;
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String craft = request.getParameter("craft");
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String userCode = request.getParameter("userCode");
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ Integer nums = Integer.parseInt(request.getParameter("paramsNums"));
|
|
|
+ String params = "";
|
|
|
+ if (lineSn.equals("LB")) {
|
|
|
+ MesProductRecord mpr = mesProductRecordService.findSnByMsn(sn);
|
|
|
+ if (!ObjectUtils.isEmpty(mpr)) {
|
|
|
+ sn = mpr.getSn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (nums > 0) {
|
|
|
+ result = "OK";
|
|
|
+ for (int i = 0; i < nums; i++) {
|
|
|
+ String sparam = ProtocolParam.getParam(msg, i + 1);
|
|
|
+ params += sparam;
|
|
|
+ if (ProtocolParam.getParamResult(sparam).equals("NG")) {
|
|
|
+ result = "NG";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result = "OK";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ mesProductRecordService.updateRecord(sn, oprno, craft, params, result, userCode, lineSn);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData("RSOK");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 独立接口:查询确认报文
|
|
|
+ @PostMapping(value = "recordConfirm")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp recordConfirmApi(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp();
|
|
|
+ String msg = request.getParameter("msg");
|
|
|
+
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String lx = request.getParameter("lx").trim();
|
|
|
+ String lineSn = request.getParameter("lineSn").trim();
|
|
|
+ if (lineSn.equals("LB")) {
|
|
|
+ MesProductRecord mpr = mesProductRecordService.findSnByMsn(sn);
|
|
|
+ if (!ObjectUtils.isEmpty(mpr)) {
|
|
|
+ sn = mpr.getSn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lx.equals("JG")) {
|
|
|
+ // 与原逻辑保持一致,当前未处理
|
|
|
+ } else if (lx.equals("SM")) {
|
|
|
+ // 与原逻辑保持一致,当前未处理
|
|
|
+ } else if (lx.equals("BD")) {
|
|
|
+ // 与原逻辑保持一致,当前未处理
|
|
|
+ }
|
|
|
+ resp.setData(lx + "NG");
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//创建订单报文
|
|
|
//msg=aaaabbbbbABWMCJWGWOP040 ID151245P00000106200123062900001 DA2023-07-01ZT10:01:25
|
|
|
- private String createOrder(String msg){
|
|
|
+ private String createOrder( String msg){
|
|
|
String ret = "RSNS";
|
|
|
String sn = ProtocolParam.getSn(msg).trim();
|
|
|
String oprno = ProtocolParam.getOprno(msg).trim();
|