jingbo 5 месяцев назад
Родитель
Сommit
a6eafd9fbd

+ 2 - 0
src/main/java/com/jeesite/modules/mes/dao/MesProcessProductDao.java

@@ -13,4 +13,6 @@ import com.jeesite.modules.mes.entity.MesProductCate;
 @MyBatisDao
 public interface MesProcessProductDao extends CrudDao<MesProcessProduct> {
     MesProcessProduct findInfo(MesProcessProduct mesProcessProduct);
+
+    void updateSnIsNull(MesProcessProduct mesProcessProduct1);
 }

+ 9 - 0
src/main/java/com/jeesite/modules/mes/service/MesProcessProductService.java

@@ -96,4 +96,13 @@ public class MesProcessProductService extends CrudService<MesProcessProductDao,
 		super.delete(mesProcessProduct);
 	}
 	
+	/**
+	 * 更新sn为null
+	 * @param mesProcessProduct
+	 */
+	@Transactional
+	public void updateSnIsNull(MesProcessProduct mesProcessProduct) {
+		mesProcessProductDao.updateSnIsNull(mesProcessProduct);
+	}
+	
 }

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

@@ -117,6 +117,8 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 	private MesProductModelService mesProductModelService;
     @Autowired
     private MesProductModifyRecordService mesProductModifyRecordService;
+    @Autowired
+    private MesProcessProductDao mesProcessProductDao;
 
 	@Override
 	public void save(MesProductRecord mesProductRecord) {
@@ -753,9 +755,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		MesProcessProduct mesProcessProduct = new MesProcessProduct();
 		mesProcessProduct.setOprno(oldOprno);
 		mesProcessProduct.setProductCate(lineSn);
-		MesProcessProduct mesProcessProduct1 = mesProcessProductService.get(mesProcessProduct);
-		mesProcessProduct1.setSn("");
-		mesProcessProductService.update(mesProcessProduct1);
+		mesProcessProductService.updateSnIsNull(mesProcessProduct);
 
 		// 下线工位
 		MesLineProcess mesLineProcess = mesLineProcessService.getOffLineOprno(lineSn);

+ 23 - 8
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -4143,6 +4143,13 @@ public class MesProductRecordController extends BaseController {
 			return resp;
 		}
 
+		// 判断工件码是否为空
+		if(StringUtils.isEmpty(mesProcessProduct1.getSn()) || mesProcessProduct1.getSn().equals("")) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage("当前工位暂无加工工件");
+			return resp;
+		}
+
 		resp.setData(mesProcessProduct1.getSn());
 		resp.setResult(Global.TRUE);
 		resp.setMessage("成功");
@@ -4246,27 +4253,24 @@ public class MesProductRecordController extends BaseController {
 		try {
 			if (!craft.equals("100000")){
 				mesProductRecordService.updateRecord(sn,oprno, craft,"",result,userCode,lineSn);
+				return renderResult(Global.TRUE, text("操作成功!"));
 			}else {
 
 				List<ParamsResp> params = mesProductRecordService.getQualityParams(oldOprno,lineSn,ps);
 				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params);
 				logger.info("res:"+res);
-				if(!res.equals("RSOK")){
-					String lx = ret.substring(0,2);
-					String checkret = ret.substring(2,4);
-					String lmsg = ErrorMsg.getErrorMsg(checkret,lx);
-					return renderResult(Global.FALSE, text(lmsg));
+				if(res == null || !res.equals("RSOK")){
+					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+					return renderResult(Global.FALSE, text("操作失败!"));
 				}else{
 					return renderResult(Global.TRUE, text("操作成功!"));
 				}
 			}
 		} catch (Exception e) {
-			// 手动设置回滚,防止@Transactional失效
 			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 			logger.info(e.getMessage());
 			return renderResult(Global.FALSE, text("操作失败!"));
 		}
-		return renderResult(Global.TRUE, text("操作成功!"));
 	}
 
 	// 客户端创建订单接口
@@ -4524,7 +4528,18 @@ public class MesProductRecordController extends BaseController {
 	@PostMapping(value = "pdaQueryQuality")
 	@ResponseBody
 	public CommonResp pdaQueryQuality(HttpServletRequest request) {
-		CommonResp resp = pccheck(request);
+
+		CommonResp resp = new CommonResp<>();
+
+		// 查询工位是否有数据
+		resp =pdaQueryIsSn(request);
+		if ("false".equals(resp.getResult())){
+			return resp;
+		}
+
+
+
+		resp = pccheck(request);
 		String sn = request.getParameter("sn");
 		String oprno = request.getParameter("oprno");
 		String lineSn = request.getParameter("lineSn");

+ 17 - 10
src/main/resources/mappings/modules/mes/MesProcessProductDao.xml

@@ -1,16 +1,23 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jeesite.modules.mes.dao.MesProcessProductDao">
-	
-	<!-- 查询数据
-	<select id="findList" resultType="MesProcessProduct">
-		SELECT ${sqlMap.column.toSql()}
-		FROM ${sqlMap.table.toSql()}
-		<where>
-			${sqlMap.where.toSql()}
-		</where>
-		ORDER BY ${sqlMap.order.toSql()}
-	</select> -->
+
+    <update id="updateSnIsNull">
+-- 根据工位和产线代码去除sn
+        UPDATE mes_process_product SET sn = null
+        WHERE product_cate = #{productCate}
+        AND oprno = #{oprno}
+    </update>
+
+    <!-- 查询数据
+    <select id="findList" resultType="MesProcessProduct">
+        SELECT ${sqlMap.column.toSql()}
+        FROM ${sqlMap.table.toSql()}
+        <where>
+            ${sqlMap.where.toSql()}
+        </where>
+        ORDER BY ${sqlMap.order.toSql()}
+    </select> -->
 
     <select id="findInfo" resultType="com.jeesite.modules.mes.entity.MesProcessProduct">
         SELECT ${sqlMap.column.toSql()}