瀏覽代碼

忽略line_sn,兼容多线

liuwei 2 周之前
父節點
當前提交
46250d0c04

+ 9 - 4
src/main/java/com/jeesite/modules/mes/service/MesProductRecordService.java

@@ -224,7 +224,8 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		mesProductRecord.setSn(sn);
 		mesProductRecord.setOprno(oprno);
 		mesProductRecord.setCraft(craft);
-		mesProductRecord.setLineSn(cate);
+		// 忽略line_sn要求,兼容多线:查记录不再按产线过滤(客户端仍可传lineSn)
+		// mesProductRecord.setLineSn(cate);
 		return mesProductRecordDao.findInfo(mesProductRecord);
 	}
 
@@ -583,7 +584,8 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		MesProductRecord mesProductRecord1 = new MesProductRecord();
 		mesProductRecord1.setOprno(oprno);
 		mesProductRecord1.getSqlMap().getWhere().and("sn",QueryType.EQ,sn);
-		mesProductRecord1.setLineSn(lineSn);
+		// 忽略line_sn要求,兼容多线:查记录不再按产线过滤(客户端仍可传lineSn,不改写记录上的line_sn)
+		// mesProductRecord1.setLineSn(lineSn);
 		List<MesProductRecord> lists = findList(mesProductRecord1);
 		if(ListUtils.isEmpty(lists)){
 			throw new ServiceException(text("记录不存在!"));
@@ -723,7 +725,9 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 						mesProductGp12Items.setModifyId(mesProductModifyRecord1.getId());
 						mesProductGp12Items.setSn(sn);
 						mesProductGp12Items.setOprno(oldOprno);
-						mesProductGp12Items.setLineSn(lineSn);
+						// 忽略line_sn要求,兼容多线:履历用记录上的产线,不用请求lineSn覆盖
+						// mesProductGp12Items.setLineSn(lineSn);
+						mesProductGp12Items.setLineSn(mesProductRecord.getLineSn());
 						mesProductGp12Items.setCreateBy(userCode);
 						mesProductGp12Items.setUpdateBy(userCode);
 						mesProductGp12Items.setResult(result);
@@ -1026,7 +1030,8 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		MesProductRecord mesProductRecord1 = new MesProductRecord();
 		mesProductRecord1.setOprno(oprno);
 		mesProductRecord1.getSqlMap().getWhere().and("sn",QueryType.EQ,sn);
-		mesProductRecord1.setLineSn(lineSn);
+		// 忽略line_sn要求,兼容多线:查记录不再按产线过滤(客户端仍可传lineSn)
+		// mesProductRecord1.setLineSn(lineSn);
 		List<MesProductRecord> lists = findList(mesProductRecord1);
 		if(ListUtils.isEmpty(lists)){
 			throw new ServiceException(text("记录不存在!"));

+ 7 - 4
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -2668,7 +2668,7 @@ public class MesProductRecordController extends BaseController {
 	// 客户端上传接口
 	@PostMapping(value = "pcresult")
 	@ResponseBody
-	@Transactional
+	// 去掉 Controller 层 @Transactional,避免业务异常被 catch 后出现 UnexpectedRollbackException(500)
 	public String pcresult(HttpServletRequest request) {
 		mesLogService.apisavexz(request);
 		String sn = request.getParameter("sn");
@@ -2858,10 +2858,13 @@ public class MesProductRecordController extends BaseController {
 
 		}catch (Exception e){
 			e.printStackTrace();
-			// 手动设置回滚,防止@Transactional失效
-			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 			logger.info(e.getMessage());
-			return renderResult(Global.FALSE, text("操作失败!"));
+			// 直接返回业务异常信息,便于 Postman 排查(不再 setRollbackOnly 导致 500)
+			String msg = e.getMessage();
+			if(StringUtils.isEmpty(msg)){
+				msg = "操作失败!";
+			}
+			return renderResult(Global.FALSE, text(msg));
 		}
 
 		return renderResult(Global.TRUE, text("操作成功!"));

+ 3 - 1
src/main/resources/mappings/modules/mes/MesProductRecordDao.xml

@@ -69,7 +69,9 @@
     </update>
     <update id="updateResultByCheckFirst">
         update mes_product_record set content =#{content}
-        where sn = #{sn} and oprno = #{oprno} and line_sn = #{lineSn} and craft = #{craft}
+        <!-- 忽略line_sn要求,兼容多线:更新结果不再按产线过滤 -->
+        <!-- where sn = #{sn} and oprno = #{oprno} and line_sn = #{lineSn} and craft = #{craft} -->
+        where sn = #{sn} and oprno = #{oprno} and craft = #{craft}
     </update>
     <update id="updateDate">
         update ${sqlMap.table.toSql()}