| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.production.mapper.ProductProcessMapper; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private ProductProcessMapper productProcessMapper; |
| | | |
| | | @Override |
| | | public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) { |
| | |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | AjaxResult processCheckResult = validateProductProcess(deviceLedger.getProductProcessId()); |
| | | if (processCheckResult != null) { |
| | | return processCheckResult; |
| | | } |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | AjaxResult processCheckResult = validateProductProcess(deviceLedger.getProductProcessId()); |
| | | if (processCheckResult != null) { |
| | | return processCheckResult; |
| | | } |
| | | if (this.updateById(deviceLedger)) { |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DeviceLedger getDetailById(Long id) { |
| | | return deviceLedgerMapper.selectById1(id); |
| | | } |
| | | |
| | | private AjaxResult validateProductProcess(Long productProcessId) { |
| | | if (productProcessId == null) { |
| | | return null; |
| | | } |
| | | ProductProcess productProcess = productProcessMapper.selectById(productProcessId); |
| | | if (productProcess == null) { |
| | | return AjaxResult.error("工序不存在,请重新选择"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | |
| | | if (ids == null || ids.length == 0) { |