设备异常修改

赵嘉伟 4 years ago
parent 44d88c8fc6
commit cf5819b295

@ -28,6 +28,6 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
*/
AbnormalBillDto findAllByAbnormalNoDevice(@Param("abnormalBill")AbnormalBill abnormalBill, @Param("language")String language);
List<AbnormalBill> findCountBySfc(@Param("site")String site,@Param("type")String type,@Param("sfc")String sfc,@Param("status")List<String> status);
}

@ -186,12 +186,32 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
// List<NcCode> ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode());
// if(ncByNG == null || ncByNG.size() <= 0){
// throw BusinessException.build("该消息类型下没有该不良代码");
// }
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
List<String> status = new ArrayList<>();
status.add(Constants.PROGRAM_CONFIRM);
status.add(Constants.CANCEL);
status.add(Constants.SHUT_DOWN);
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
if(abnormalBillList.size() > 1 && !"更新成功".equals(message)){
throw BusinessException.build("设备异常有未处理完成的sfc");
}else if(abnormalBillList.size() > 1 ){
throw BusinessException.build("设备异常有未处理完成的sfc");
}
}
return message;
}
@ -485,9 +505,21 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
*
*
*/
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) {
throw BusinessException.build("产品条码不能为空");
}
// }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
// AbnormalBill abnormalBill2 = new AbnormalBill();
// abnormalBill2.setType(abnormalBill.getType());
// abnormalBill2.setSfc(abnormalBill.getSfc());
// abnormalBill2.setStatus(Constants.NEW);
// List<AbnormalBill> abnormalBills = this.selectList(abnormalBill2);
// if(abnormalBills.size() > 0 && !"更新成功".equals(message)){
// throw BusinessException.build("设备异常有未处理完成的sfc");
// }else if(abnormalBills.size() > 1){
// throw BusinessException.build("设备异常有未处理完成的sfc");
// }
// }
// if(StringUtil.isBlank(abnormalBill.getResrce())){
// throw BusinessException.build("设备编号不能为空");
// }

@ -885,4 +885,27 @@
</if>
</where>
</select>
<select id="findCountBySfc" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ABNORMAL_BILL
<where>
<if test="site != null and site != ''">
SITE = #{site}
</if>
<if test="status != null and status.size() != 0">
AND STATUS NOT IN
<foreach collection="status" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="type != null and type != ''">
AND "TYPE" = #{type}
</if>
<if test="sfc != null and sfc != ''">
AND SFC = #{sfc}
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save