| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fzzy.igds.bill.InoutBill; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.constant.FoodLevel; |
| | | import com.fzzy.igds.constant.FoodVariety; |
| | | import com.fzzy.igds.constant.RedisConst; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | queryWrapper.eq("settle_tag", param.getSettleTag()); |
| | | } |
| | | if (null != param.getStart()) { |
| | | queryWrapper.ge("create_time", DateUtil.getCurZero(param.getStart())); |
| | | queryWrapper.ge("complete_time", DateUtil.getCurZero(param.getStart())); |
| | | } |
| | | if (null != param.getEnd()) { |
| | | queryWrapper.le("create_time", DateUtil.getNextZero(param.getEnd())); |
| | | queryWrapper.le("complete_time", DateUtil.getNextZero(param.getEnd())); |
| | | } |
| | | queryWrapper.ne("record_status", Constant.RECORD_STATUS_DEL); //不是删除的单子,即正常的单子 |
| | | queryWrapper.orderByDesc("create_time"); |
| | | queryWrapper.orderByDesc("complete_time"); |
| | | |
| | | return queryWrapper; |
| | | } |
| | | |
| | | /** |
| | | * 根据时间类型,获取已完成的正常单据 |
| | | * |
| | | * @param timeType |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public List<InoutRecord> getCompleteInoutByTime(String timeType, IgdsBaseParam param) { |
| | | if(StringUtils.isBlank(timeType)){ |
| | | return null; |
| | | if (StringUtils.isBlank(timeType)) { |
| | | return null; |
| | | } |
| | | |
| | | QueryWrapper<InoutRecord> queryWrapper = new QueryWrapper<>(); |
| | |
| | | InoutRecord record = new InoutRecord(); |
| | | BeanUtils.copyProperties(data, record); |
| | | //保存 |
| | | int num = this.addInoutRecord(record); |
| | | int num = this.addInoutRecord(record,true); |
| | | |
| | | //附件处理 |
| | | fileService.saveInoutFiles(data.getFiles(), record.getId(), null, "INOUT"); |
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public String addInoutRecordList(List<InoutRecord> list) { |
| | | if(null == list || list.isEmpty()){ |
| | | public String addInoutRecordList(List<InoutRecord> list,boolean isCache) { |
| | | if (null == list || list.isEmpty()) { |
| | | return "新增失败"; |
| | | } |
| | | |
| | | for (InoutRecord inoutRecord : list) { |
| | | addInoutRecord(inoutRecord); |
| | | addInoutRecord(inoutRecord,isCache); |
| | | } |
| | | |
| | | return null; |
| | |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public int addInoutRecord(InoutRecord data) { |
| | | public int addInoutRecord(InoutRecord data,boolean isCache) { |
| | | |
| | | if (StringUtils.isBlank(data.getId())) { |
| | | String id = this.createId(data.getRegisterTime(), data.getCompanyId()); |
| | | String id = this.createId(data.getRegisterTime(), data.getCompanyId(),isCache); |
| | | if (Constant.TYPE_IN.equals(data.getType())) { |
| | | data.setId("R_" + id); |
| | | } else if (Constant.TYPE_OUT.equals(data.getType())) { |
| | |
| | | |
| | | /** |
| | | * 数据修改,保留修改记录 |
| | | * |
| | | * @param updateData |
| | | * @return |
| | | */ |
| | |
| | | param.setId(updateData.getId()); |
| | | InoutRecord record = this.selectOne(param); |
| | | |
| | | String remarks = checkRemarks(updateData, record); |
| | | updateData.setRemarks(remarks); |
| | | String updateLog = checkRemarks(updateData, record); |
| | | updateData.setUpdateLog(updateLog); |
| | | |
| | | return updateInoutRecord(updateData); |
| | | } |
| | | |
| | | /** |
| | | * 校验修改信息 |
| | | * @param updateData 修改数据 |
| | | * @param record 原始数据 |
| | | * |
| | | * @param updateData 修改数据 |
| | | * @param record 原始数据 |
| | | * @return |
| | | */ |
| | | public String checkRemarks(InoutRecord updateData, InoutRecord record) { |
| | | |
| | | String remarks = "【" + ContextUtil.getLoginUserName() + "】于["+DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")+"]修改数据:"; |
| | | String updateLog0 = "【" + ContextUtil.getLoginUserName() + "】于[" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "]修改数据:"; |
| | | String updateLog = ""; |
| | | |
| | | boolean updateTag = false; |
| | | //校验仓库信息 |
| | | if(null != updateData.getDepotId() && null != record.getDepotId()){ |
| | | if (null != updateData.getDepotId() && null != record.getDepotId()) { |
| | | updateTag = !updateData.getDepotId().equals(record.getDepotId()); |
| | | if(updateTag){ |
| | | remarks += "[仓库编码](" + record.getDepotId() + ")修改为(" + updateData.getDepotId() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[仓库编码](" + record.getDepotId() + ")修改为(" + updateData.getDepotId() + "),"; |
| | | } |
| | | } |
| | | |
| | | //校验品种信息 |
| | | if(null != updateData.getFoodVariety() && null != record.getFoodVariety()){ |
| | | if (null != updateData.getFoodVariety() && null != record.getFoodVariety()) { |
| | | updateTag = !updateData.getFoodVariety().equals(record.getFoodVariety()); |
| | | if(updateTag){ |
| | | remarks += "[品种](" + record.getFoodVariety() + ")修改为(" + updateData.getFoodVariety() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[品种](" + FoodVariety.getMsg(record.getFoodVariety()) + ")修改为(" + FoodVariety.getMsg(updateData.getFoodVariety()) + "),"; |
| | | } |
| | | } |
| | | |
| | | //粮食产地 |
| | | if(null != updateData.getFoodLocation() && null != record.getFoodLocation()){ |
| | | if (null != updateData.getFoodLocation() && null != record.getFoodLocation()) { |
| | | updateTag = !updateData.getFoodLocation().equals(record.getFoodLocation()); |
| | | if(updateTag){ |
| | | remarks += "[粮食产地](" + record.getFoodLocation() + ")修改为(" + updateData.getFoodLocation() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[粮食产地](" + record.getFoodLocation() + ")修改为(" + updateData.getFoodLocation() + "),"; |
| | | } |
| | | } |
| | | |
| | | //粮食等级 |
| | | if(null != updateData.getFoodLevel() && null != record.getFoodLevel()){ |
| | | if (null != updateData.getFoodLevel() && null != record.getFoodLevel()) { |
| | | updateTag = !updateData.getFoodLevel().equals(record.getFoodLevel()); |
| | | if(updateTag){ |
| | | remarks += "[粮食等级](" + record.getFoodLevel() + ")修改为(" + updateData.getFoodLevel() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[粮食等级](" + FoodLevel.getMsg(record.getFoodLevel()) + ")修改为(" + FoodLevel.getMsg(updateData.getFoodLevel()) + "),"; |
| | | } |
| | | } |
| | | |
| | | //粮食年份 |
| | | if(null != updateData.getFoodYear() && null != record.getFoodYear()){ |
| | | if (null != updateData.getFoodYear() && null != record.getFoodYear()) { |
| | | updateTag = !updateData.getFoodYear().equals(record.getFoodYear()); |
| | | if(updateTag){ |
| | | remarks += "[粮食年份](" + record.getFoodYear() + ")修改为(" + updateData.getFoodYear() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[粮食年份](" + record.getFoodYear() + ")修改为(" + updateData.getFoodYear() + "),"; |
| | | } |
| | | } |
| | | |
| | | //承运人 |
| | | if(null != updateData.getUserName() && null != record.getUserName()){ |
| | | if (null != updateData.getUserName() && null != record.getUserName()) { |
| | | updateTag = !updateData.getUserName().equals(record.getUserName()); |
| | | if(updateTag){ |
| | | remarks += "[承运人](" + record.getUserName() + ")修改为(" + updateData.getUserName() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[承运人](" + record.getUserName() + ")修改为(" + updateData.getUserName() + "),"; |
| | | } |
| | | } |
| | | |
| | | //校验通知单信息 |
| | | if(null != updateData.getNoticeId() && null != record.getNoticeId()){ |
| | | if (null != updateData.getNoticeId() && null != record.getNoticeId()) { |
| | | updateTag = !updateData.getNoticeId().equals(record.getNoticeId()); |
| | | if(updateTag){ |
| | | remarks += "[通知单编码](" + record.getNoticeId() + ")修改为(" + updateData.getNoticeId() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[通知单编码](" + record.getNoticeId() + ")修改为(" + updateData.getNoticeId() + "),"; |
| | | } |
| | | } |
| | | |
| | | //校验往来单位信息 |
| | | if(null != updateData.getCustomerName() && null != record.getCustomerName()){ |
| | | if (null != updateData.getCustomerName() && null != record.getCustomerName()) { |
| | | updateTag = !updateData.getCustomerName().equals(record.getCustomerName()); |
| | | if(updateTag){ |
| | | remarks += "[往来单位](" + record.getCustomerName() + ")修改为(" + updateData.getCustomerName() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[往来单位](" + record.getCustomerName() + ")修改为(" + updateData.getCustomerName() + "),"; |
| | | } |
| | | } |
| | | |
| | | //单价 |
| | | if(null != updateData.getPrice() && null != record.getPrice()){ |
| | | if (null != updateData.getPrice() && null != record.getPrice()) { |
| | | updateTag = !updateData.getPrice().equals(record.getPrice()); |
| | | if(updateTag){ |
| | | remarks += "[单价](" + record.getPrice() + ")修改为(" + updateData.getPrice() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[单价](" + record.getPrice() + ")修改为(" + updateData.getPrice() + "),"; |
| | | } |
| | | } |
| | | |
| | | //结算金额 |
| | | if(null != updateData.getSettleMoney() && null != record.getSettleMoney()){ |
| | | if (null != updateData.getSettleMoney() && null != record.getSettleMoney()) { |
| | | updateTag = !updateData.getSettleMoney().equals(record.getSettleMoney()); |
| | | if(updateTag){ |
| | | remarks += "[结算金额](" + record.getSettleMoney() + ")修改为(" + updateData.getSettleMoney() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[结算金额](" + record.getSettleMoney() + ")修改为(" + updateData.getSettleMoney() + "),"; |
| | | } |
| | | } |
| | | |
| | | //水分 |
| | | if(null != updateData.getPerWet() && null != record.getPerWet()){ |
| | | if (null != updateData.getPerWet() && null != record.getPerWet()) { |
| | | updateTag = !updateData.getPerWet().equals(record.getPerWet()); |
| | | if(updateTag){ |
| | | remarks += "[水分](" + record.getPerWet() + ")修改为(" + updateData.getPerWet() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[水分](" + record.getPerWet() + ")修改为(" + updateData.getPerWet() + "),"; |
| | | } |
| | | } |
| | | |
| | | //杂质 |
| | | if(null != updateData.getPerImpurity() && null != record.getPerImpurity()){ |
| | | if (null != updateData.getPerImpurity() && null != record.getPerImpurity()) { |
| | | updateTag = !updateData.getPerImpurity().equals(record.getPerImpurity()); |
| | | if(updateTag){ |
| | | remarks += "[杂质](" + record.getPerImpurity() + ")修改为(" + updateData.getPerImpurity() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[杂质](" + record.getPerImpurity() + ")修改为(" + updateData.getPerImpurity() + "),"; |
| | | } |
| | | } |
| | | |
| | | //毛重 |
| | | if(null != updateData.getFullWeight() && null != record.getFullWeight()){ |
| | | if (null != updateData.getFullWeight() && null != record.getFullWeight()) { |
| | | updateTag = !updateData.getFullWeight().equals(record.getFullWeight()); |
| | | if(updateTag){ |
| | | remarks += "[毛重](" + record.getFullWeight() + ")修改为(" + updateData.getFullWeight() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[毛重](" + record.getFullWeight() + ")修改为(" + updateData.getFullWeight() + "),"; |
| | | } |
| | | } |
| | | |
| | | //皮重 |
| | | if(null != updateData.getEmptyWeight() && null != record.getEmptyWeight()){ |
| | | if (null != updateData.getEmptyWeight() && null != record.getEmptyWeight()) { |
| | | updateTag = !updateData.getEmptyWeight().equals(record.getEmptyWeight()); |
| | | if(updateTag){ |
| | | remarks += "[皮重](" + record.getEmptyWeight() + ")修改为(" + updateData.getEmptyWeight() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[皮重](" + record.getEmptyWeight() + ")修改为(" + updateData.getEmptyWeight() + "),"; |
| | | } |
| | | } |
| | | |
| | | //扣重 |
| | | if(null != updateData.getDeOther() && null != record.getDeOther()){ |
| | | if (null != updateData.getDeOther() && null != record.getDeOther()) { |
| | | updateTag = !updateData.getDeOther().equals(record.getDeOther()); |
| | | if(updateTag){ |
| | | remarks += "[扣重](" + record.getDeOther() + ")修改为(" + updateData.getDeOther() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[扣重](" + record.getDeOther() + ")修改为(" + updateData.getDeOther() + "),"; |
| | | } |
| | | } |
| | | |
| | | //结算重量 |
| | | if(null != updateData.getSettleWeight() && null != record.getSettleWeight()){ |
| | | if (null != updateData.getSettleWeight() && null != record.getSettleWeight()) { |
| | | updateTag = !updateData.getSettleWeight().equals(record.getSettleWeight()); |
| | | if(updateTag){ |
| | | remarks += "[结算重量](" + record.getSettleWeight() + ")修改为(" + updateData.getSettleWeight() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[结算重量](" + record.getSettleWeight() + ")修改为(" + updateData.getSettleWeight() + "),"; |
| | | } |
| | | } |
| | | |
| | | //出入库重量 |
| | | if(null != updateData.getRecordWeight() && null != record.getRecordWeight()){ |
| | | if (null != updateData.getRecordWeight() && null != record.getRecordWeight()) { |
| | | updateTag = !updateData.getRecordWeight().equals(record.getRecordWeight()); |
| | | if(updateTag){ |
| | | remarks += "[出入库重量](" + record.getRecordWeight() + ")修改为(" + updateData.getRecordWeight() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[出入库重量](" + record.getRecordWeight() + ")修改为(" + updateData.getRecordWeight() + "),"; |
| | | } |
| | | } |
| | | |
| | | //登记时间 |
| | | if(null != updateData.getRegisterTime() && null != record.getRegisterTime()){ |
| | | if (null != updateData.getRegisterTime() && null != record.getRegisterTime()) { |
| | | updateTag = !updateData.getRegisterTime().equals(record.getRegisterTime()); |
| | | if(updateTag){ |
| | | remarks += "[登记时间](" + DateFormatUtils.format(record.getRegisterTime(),"yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getRegisterTime(),"yyyy-MM-dd HH:mm:ss") + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[登记时间](" + DateFormatUtils.format(record.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + "),"; |
| | | } |
| | | } |
| | | |
| | | //满车时间 |
| | | if(null != updateData.getFullWeightTime() && null != record.getFullWeightTime()){ |
| | | if (null != updateData.getFullWeightTime() && null != record.getFullWeightTime()) { |
| | | updateTag = !updateData.getFullWeightTime().equals(record.getFullWeightTime()); |
| | | if(updateTag){ |
| | | remarks += "[满车时间](" + DateFormatUtils.format(record.getFullWeightTime(),"yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getFullWeightTime(),"yyyy-MM-dd HH:mm:ss") + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[满车时间](" + DateFormatUtils.format(record.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),"; |
| | | } |
| | | } |
| | | |
| | | //空车时间 |
| | | if(null != updateData.getEmptyWeightTime() && null != record.getEmptyWeightTime()){ |
| | | if (null != updateData.getEmptyWeightTime() && null != record.getEmptyWeightTime()) { |
| | | updateTag = !updateData.getEmptyWeightTime().equals(record.getEmptyWeightTime()); |
| | | if(updateTag){ |
| | | remarks += "[空车时间](" + DateFormatUtils.format(record.getEmptyWeightTime(),"yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getEmptyWeightTime(),"yyyy-MM-dd HH:mm:ss") + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[空车时间](" + DateFormatUtils.format(record.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),"; |
| | | } |
| | | } |
| | | |
| | | //完成时间 |
| | | if(null != updateData.getCompleteTime() && null != record.getCompleteTime()){ |
| | | if (null != updateData.getCompleteTime() && null != record.getCompleteTime()) { |
| | | updateTag = !updateData.getCompleteTime().equals(record.getCompleteTime()); |
| | | if(updateTag){ |
| | | remarks += "[完成时间](" + DateFormatUtils.format(record.getCompleteTime(),"yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getCompleteTime(),"yyyy-MM-dd HH:mm:ss") + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[完成时间](" + DateFormatUtils.format(record.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + ")修改为(" + DateFormatUtils.format(updateData.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + "),"; |
| | | } |
| | | } |
| | | |
| | | //满车称重人 |
| | | if(null != updateData.getFullWeightUser() && null != record.getFullWeightUser()){ |
| | | if (null != updateData.getFullWeightUser() && null != record.getFullWeightUser()) { |
| | | updateTag = !updateData.getFullWeightUser().equals(record.getFullWeightUser()); |
| | | if(updateTag){ |
| | | remarks += "[满车称重人](" + record.getFullWeightUser() + ")修改为(" + updateData.getFullWeightUser() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[满车称重人](" + record.getFullWeightUser() + ")修改为(" + updateData.getFullWeightUser() + "),"; |
| | | } |
| | | } |
| | | |
| | | //空车称重人 |
| | | if(null != updateData.getEmptyWeightUser() && null != record.getEmptyWeightUser()){ |
| | | if (null != updateData.getEmptyWeightUser() && null != record.getEmptyWeightUser()) { |
| | | updateTag = !updateData.getEmptyWeightUser().equals(record.getEmptyWeightUser()); |
| | | if(updateTag){ |
| | | remarks += "[空车称重人](" + record.getEmptyWeightUser() + ")修改为(" + updateData.getEmptyWeightUser() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[空车称重人](" + record.getEmptyWeightUser() + ")修改为(" + updateData.getEmptyWeightUser() + "),"; |
| | | } |
| | | } |
| | | |
| | | //备注说明 |
| | | if(null != updateData.getRemarks() && null != record.getRemarks()){ |
| | | if (null != updateData.getRemarks() && null != record.getRemarks()) { |
| | | updateTag = !updateData.getRemarks().equals(record.getRemarks()); |
| | | if(updateTag){ |
| | | remarks += "[备注说明](" + record.getRemarks() + ")修改为(" + updateData.getRemarks() + "),"; |
| | | if (updateTag) { |
| | | updateLog += "[备注说明](" + record.getRemarks() + ")修改为(" + updateData.getRemarks() + "),"; |
| | | } |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(record.getRemarks())){ |
| | | remarks = record.getRemarks() + ";" + remarks; |
| | | if (StringUtils.isBlank(updateLog)) { |
| | | return record.getUpdateLog() == null ? "" : record.getUpdateLog(); |
| | | } |
| | | |
| | | return remarks; |
| | | updateLog0 = updateLog0 + updateLog; |
| | | |
| | | return record.getUpdateLog() == null ? updateLog0 : (record.getUpdateLog() + ";" + updateLog0); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | public String createId(Date registerTime, String companyId) { |
| | | public String createId(Date registerTime, String companyId,boolean isCache) { |
| | | |
| | | // 时间戳标签 |
| | | String timeKey = DateFormatUtils.format(registerTime, "yyyyMMdd"); |
| | |
| | | // 从缓存中获取已有的组织编码 |
| | | String cacheKey = RedisConst.buildKey(companyId, Constant.CACHE_RECORD_ID); |
| | | |
| | | String cacheId = (String) redisCache.getCacheObject(cacheKey); |
| | | String cacheId = null; |
| | | if (isCache) { |
| | | cacheId=(String) redisCache.getCacheObject(cacheKey); |
| | | } |
| | | |
| | | if (null != cacheId && cacheId.indexOf(timeKey) >= 0) { |
| | | String temp = cacheId.substring(cacheId.length() - 4); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 数据库 ID 重复校验,确保新生成的 ID 在数据库中不存在 |
| | | while (this.checkIdExists(companyId, cacheId)) { |
| | | String temp = cacheId.substring(cacheId.length() - 4); |
| | | Integer i = Integer.valueOf(temp); |
| | | i++; |
| | | temp = String.valueOf(i); |
| | | if (temp.length() == 1) { |
| | | cacheId = timeKey + "000" + temp; |
| | | } |
| | | if (temp.length() == 2) { |
| | | cacheId = timeKey + "00" + temp; |
| | | } |
| | | if (temp.length() == 3) { |
| | | cacheId = timeKey + "0" + temp; |
| | | } |
| | | if (temp.length() == 4) { |
| | | cacheId = timeKey + temp; |
| | | } |
| | | } |
| | | |
| | | // 更新缓存 |
| | | redisCache.setCacheObject(cacheKey, cacheId); |
| | | if(isCache){ |
| | | redisCache.setCacheObject(cacheKey, cacheId); |
| | | } |
| | | |
| | | return cacheId; |
| | | } |
| | | |
| | | /** |
| | | * 检查 ID 是否在数据库中已存在 |
| | | * |
| | | * @param companyId |
| | | * @param id |
| | | * @return true-已存在,false-不存在 |
| | | */ |
| | | public boolean checkIdExists(String companyId, String id) { |
| | | QueryWrapper<InoutRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("company_id", companyId); |
| | | //使用likeleft |
| | | queryWrapper.likeLeft("id", id); |
| | | List<InoutRecord> inoutRecords = inoutRecordMapper.selectList(queryWrapper); |
| | | if( null != inoutRecords && inoutRecords.size() > 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | queryWrapper.eq("company_id", companyId); |
| | | queryWrapper.like("id", timeKey); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | |
| | | queryWrapper.orderByDesc("register_time"); |
| | | List<InoutRecord> inoutRecords = inoutRecordMapper.selectList(queryWrapper); |
| | | if (null == inoutRecords || inoutRecords.isEmpty()) { |
| | | return null; |
| | |
| | | public String inWeightBill(InoutRecord data) { |
| | | |
| | | // 获取表单数据 |
| | | InoutPrintBill bill = this.createBillData(data, "入库划码单"); |
| | | InoutPrintBill bill = this.createBillData(data, "入库单"); |
| | | |
| | | // 调整模版数据并返回 |
| | | String htmlStr = InoutBill.IN_WEIGHT_DEFAULT; |
| | | String htmlStr = InoutBill.IN_WEIGHT_DEFAULT_NEW; |
| | | |
| | | htmlStr = htmlStr.replace("billTitle", bill.getBillTitle()); |
| | | |
| | |
| | | htmlStr = htmlStr.replace("impurity", bill.getImpurity() + ""); |
| | | |
| | | htmlStr = htmlStr.replace("checkStatus", bill.getCheckStatus()); |
| | | htmlStr = htmlStr.replace("remark", bill.getRemark()); |
| | | htmlStr = htmlStr.replace("remark", ""); |
| | | htmlStr = htmlStr.replace("moneyName", bill.getMoneyName()); |
| | | |
| | | htmlStr = htmlStr.replace("unitName", bill.getUnitName()); |
| | |
| | | htmlStr = htmlStr.replace("handleEnd", ""); |
| | | htmlStr = htmlStr.replace("noticeId", bill.getNoticeId() == null ? "" : bill.getNoticeId()); |
| | | htmlStr = htmlStr.replace("phone", data.getUserContact() == null ? "" : data.getUserContact() + ""); |
| | | htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm")); |
| | | htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | htmlStr = htmlStr.replaceAll("weightUser", |
| | | bill.getWeightUser() == null ? "" : bill.getWeightUser()); |
| | |
| | | bill.getHandleUser() == null ? "" : bill.getHandleUser()); |
| | | htmlStr = htmlStr.replaceAll("keeperName", |
| | | bill.getKeeperUser() == null ? "" : bill.getKeeperUser()); |
| | | |
| | | htmlStr = htmlStr.replaceAll("createUser",ContextUtil.getLoginUserName()); |
| | | |
| | | return htmlStr; |
| | | } |
| | |
| | | */ |
| | | public String outWeightBill(InoutRecord data) { |
| | | // 获取表单数据 |
| | | InoutPrintBill bill = this.createBillData(data, "出库划码单"); |
| | | InoutPrintBill bill = this.createBillData(data, "出库单"); |
| | | |
| | | //默认模版 |
| | | String htmlStr = InoutBill.OUT_WEIGHT_DEFAULT; |
| | | String htmlStr = InoutBill.OUT_WEIGHT_DEFAULT_NEW; |
| | | |
| | | htmlStr = htmlStr.replace("billTitle", bill.getBillTitle()); |
| | | |
| | |
| | | new DecimalFormat("0.00").format(bill.getNetWeight())); |
| | | htmlStr = htmlStr.replace("dePackage", |
| | | new DecimalFormat("0.00").format(bill.getDePackage())); |
| | | htmlStr = htmlStr.replace("remark", bill.getRemark()); |
| | | htmlStr = htmlStr.replace("remark", ""); |
| | | |
| | | htmlStr = htmlStr.replace("settleWeight", |
| | | new DecimalFormat("0.00").format(bill.getSettleWeight())); |
| | |
| | | htmlStr = htmlStr.replace("handleEnd", ""); |
| | | htmlStr = htmlStr.replace("noticeId", bill.getNoticeId() == null ? "" : bill.getNoticeId()); |
| | | htmlStr = htmlStr.replace("phone", data.getUserContact() == null ? "" : data.getUserContact() + ""); |
| | | htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm")); |
| | | htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | htmlStr = htmlStr.replaceAll("weightUser", getValue(bill.getWeightUser())); |
| | | htmlStr = htmlStr.replace("handleUser", getValue(bill.getHandleUser())); |
| | | htmlStr = htmlStr.replaceAll("keeperName", getValue(bill.getKeeperUser())); |
| | | htmlStr = htmlStr.replaceAll("createUser",ContextUtil.getLoginUserName()); |
| | | |
| | | return htmlStr; |
| | | } |
| | | |
| | |
| | | data.setRegisterTime(new Date()); |
| | | } |
| | | bill.setRegisterTime(DateFormatUtils.format(data.getRegisterTime(), |
| | | "yyyy-MM-dd HH:mm")); |
| | | "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | if (null == data.getCompleteTime()) { |
| | | data.setCompleteTime(new Date()); |
| | | } |
| | | bill.setCompleteTime(DateFormatUtils.format(data.getCompleteTime(), |
| | | "yyyy-MM-dd HH:mm")); |
| | | "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | bill.setEmptyTime(DateFormatUtils.format(data.getEmptyWeightTime(), |
| | | "yyyy-MM-dd HH:mm:ss")); |
| | |
| | | data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2)); |
| | | } |
| | | } |
| | | bill.setSettleMoney(data.getSettleMoney() == null ? "" : data.getSettleMoney() + ""); |
| | | bill.setSettleMoney(data.getSettleMoney() == null ? "" : String.format("%.2f", data.getSettleMoney())); |
| | | bill.setRemark(data.getRemarks() == null ? "" : data.getRemarks()); |
| | | |
| | | if (Constant.TYPE_IN.equals(data.getType())) { |