| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "发货信息列表") |
| | | public R<?> listPage(Page page, ShippingInfo req) { |
| | | public AjaxResult listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); |
| | | return R.ok(listPage); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.INSERT) |
| | | public R<?> add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no"); |
| | | // 发货审批 |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | approveProcessVO.setApproveType(7); |
| | | approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId()); |
| | | approveProcessVO.setApproveReason(sh);//发货编号 |
| | | approveProcessVO.setApproveUserIds(req.getApproveUserIds()); |
| | | approveProcessVO.setApproveUser(loginUser.getUserId()); |
| | | approveProcessVO.setApproveTime(LocalDate.now().toString()); |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | // 添加发货消息 |
| | | req.setShippingNo(sh); |
| | | req.setStatus("待审核"); |
| | | boolean save = shippingInfoService.add(req); |
| | | return save ? R.ok() : R.fail(); |
| | | public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | return AjaxResult.success(shippingInfoService.addReq(req) ? "添加成功" : "添加失败"); |
| | | } |
| | | |
| | | @Operation(summary = "发货扣库存") |
| | | @PostMapping("/deductStock") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) |
| | | public R<?> deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? R.ok() : R.fail(); |
| | | public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) |
| | | public R<?> update(@RequestBody ShippingInfo req) { |
| | | public AjaxResult update(@RequestBody ShippingInfo req) { |
| | | ShippingInfo byId = shippingInfoService.getById(req.getId()); |
| | | if (byId == null) { |
| | | return R.fail("发货信息不存在"); |
| | | return AjaxResult.error("发货信息不存在"); |
| | | } |
| | | boolean update = shippingInfoService.updateById(req); |
| | | return update ? R.ok() : R.fail(); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.DELETE) |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | |
| | | return shippingInfoService.delete(ids) ? R.ok("删除成功") : R.fail("删除失败"); |
| | | return shippingInfoService.delete(ids) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @Operation(summary = "通过客户名称查询关联的发货单号") |
| | | public R<?> getByCustomerName(String customerName) { |
| | | return R.ok(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | | |
| | | @GetMapping("/getDateil/{id}") |