| | |
| | | import com.fzzy.igds.mapper.InoutRecordMapper; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.igds.utils.DateUtil; |
| | | import com.fzzy.igds.utils.MoneyUtil; |
| | | import com.fzzy.igds.utils.NumberUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | if (StringUtils.isNotBlank(param.getType())) { |
| | | queryWrapper.eq("type", param.getType()); |
| | | } |
| | | if (StringUtils.isNotBlank(param.getSettleTag())) { |
| | | queryWrapper.eq("settle_tag", param.getSettleTag()); |
| | | } |
| | | if (null != param.getStart()) { |
| | | queryWrapper.ge("create_time", DateUtil.getCurZero(param.getStart())); |
| | | } |
| | | if (null != param.getEnd()) { |
| | | queryWrapper.le("create_time", DateUtil.getNextZero(param.getEnd())); |
| | | } |
| | | queryWrapper.eq("record_status", Constant.RECORD_STATUS_NORMAL); //正常状态的单子 |
| | | queryWrapper.or(); |
| | | queryWrapper.eq("record_status", Constant.RECORD_STATUS_ADD); //补录单子的单子 |
| | | queryWrapper.ne("record_status", Constant.RECORD_STATUS_DEL); //不是删除的单子,即正常的单子 |
| | | queryWrapper.orderByDesc("create_time"); |
| | | |
| | | return queryWrapper; |
| | |
| | | return bill; |
| | | } |
| | | |
| | | /** |
| | | * 获取结算单 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | public String printPay(InoutRecord data) { |
| | | |
| | | // 调整模版数据并返回 |
| | | String htmlStr = InoutBill.IN_SETTLE_DEFAULT; |
| | | //标题 |
| | | //清远出发货单位及标题,使用公司名 |
| | | String billTitle = data.getType().equals("IN") ? "入库结算单" : "出库结算单"; |
| | | |
| | | htmlStr = htmlStr.replace("[billTitle]", billTitle); |
| | | //库区名称 |
| | | SysDept dept = sysDeptService.getCacheDept(data.getCompanyId(), data.getDeptId()); |
| | | if (dept != null) { |
| | | htmlStr = htmlStr.replace("[deptId]", null == data.getDeptId() ? "" : dept.getDeptName()); |
| | | } else { |
| | | htmlStr = htmlStr.replace("[deptId]", ""); |
| | | } |
| | | |
| | | //业务单号 |
| | | htmlStr = htmlStr.replace("[id]", data.getId()); |
| | | //打印时间 |
| | | htmlStr = htmlStr.replace("[payTime]", null == data.getSettleTime() ? "" : DateFormatUtils.format(data.getSettleTime(), "yyyy年MM月dd日")); |
| | | //客户名称 |
| | | htmlStr = htmlStr.replace("[customerName]", null == data.getCustomerName() ? "" : data.getCustomerName()); |
| | | //承运人 |
| | | htmlStr = htmlStr.replace("[userName]", null == data.getUserName() ? "" : data.getUserName()); |
| | | //承运人联系电话 |
| | | htmlStr = htmlStr.replace("[userContact]", null == data.getUserContact() ? "" : data.getUserContact()); |
| | | //承运人身份证号 |
| | | htmlStr = htmlStr.replace("[userId]", null == data.getUserId() ? "" : data.getUserId()); |
| | | //承运人车牌号 |
| | | htmlStr = htmlStr.replace("[plateNum]", null == data.getPlateNum() ? "" : data.getPlateNum()); |
| | | //获取仓库信息 |
| | | Depot depot = depotService.getCacheDepot(data.getCompanyId(), data.getDepotId()); |
| | | if (null != depot) { |
| | | //货位信息 |
| | | htmlStr = htmlStr.replace("[depotId]", depot.getName()); |
| | | } |
| | | //粮食名称 |
| | | htmlStr = htmlStr.replace("[foodVariety]", null == data.getFoodVariety() ? "" : FoodVariety.getMsg(data.getFoodVariety())); |
| | | |
| | | //备注 |
| | | htmlStr = htmlStr.replace("[remark]", null == data.getRemarks() ? "" : data.getRemarks()); |
| | | //毛重 |
| | | htmlStr = htmlStr.replace("[fullWeight]", null == data.getFullWeight() ? "" : String.format("%.2f", data.getFullWeight())); |
| | | //皮重 |
| | | htmlStr = htmlStr.replace("[emptyWeight]", null == data.getEmptyWeight() ? "" : String.format("%.2f", data.getEmptyWeight())); |
| | | //扣重 |
| | | htmlStr = htmlStr.replace("[deOther]", null == data.getDeOther() ? "" : String.format("%.2f", data.getDeOther())); |
| | | //粮油价格 |
| | | htmlStr = htmlStr.replace("[payPrice]", null == data.getPrice() ? "" : String.format("%.3f", data.getPrice())); |
| | | //结算重量 |
| | | htmlStr = htmlStr.replace("[settleWeight]", String.format("%.2f", data.getSettleWeight())); |
| | | //结算金额 |
| | | htmlStr = htmlStr.replace("[payMoney]", null == data.getSettleMoney() ? "" : String.format("%.3f", data.getSettleMoney())); |
| | | |
| | | //结算重量名称 |
| | | htmlStr = htmlStr.replace("[payMoneyName]", MoneyUtil.formatToCN(new BigDecimal(String.format("%.2f", data.getSettleMoney())))); |
| | | |
| | | return htmlStr; |
| | | } |
| | | |
| | | } |