| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.Purchase; |
| | | import com.vincent.rsf.server.manager.entity.PurchaseItem; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.POExceStatus; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.manager.service.impl.PurchaseItemServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.impl.PurchaseServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @Api(tags = "ASN入库通知单") |
| | |
| | | private AsnOrderService asnOrderService; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private PurchaseServiceImpl purchaseService; |
| | | @Autowired |
| | | private PurchaseItemServiceImpl purchaseItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | @PostMapping("/asnOrder/page") |
| | |
| | | @PostMapping("/asnOrder/remove/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!asnOrderService.remove(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, Arrays.asList(ids)).eq(AsnOrder::getExceStatus, AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val))) { |
| | | return R.error("任务中单据不可删除!!"); |
| | | if (Objects.isNull(ids) || ids.length == 0) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | for (Long id : ids) { |
| | | List<AsnOrderItem> list = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, id)); |
| | | if (!list.isEmpty()) { |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>().in(AsnOrderItem::getAsnId, ids))) { |
| | | throw new CoolException("Details Delete Fail"); |
| | | } |
| | | } |
| | | } |
| | | return R.ok("删除成功!!").add(ids); |
| | | |
| | | return asnOrderService.removeOrders(Arrays.asList(ids)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | |
| | | @ApiOperation("根据PO单新建收货单") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:save')") |
| | | public R orderCreateByPo(@RequestBody Map<String, Object> params) { |
| | | if (Objects.isNull(params.get("ids"))) { |
| | | return R.error("参数不能为空!!"); |
| | | if (Objects.isNull(params.get("purchaseId"))) { |
| | | return R.error("PO主单ID不能为空!!"); |
| | | } |
| | | String json = params.get("ids").toString(); |
| | | List<Long> ids = JSONArray.parseArray(params.get("ids").toString(), Long.class); |
| | | if (ids.isEmpty()) { |
| | | return R.error("参数不能为空"); |
| | | if (Objects.isNull(params.get("items"))) { |
| | | return R.error("明细单据不能为空!!"); |
| | | } |
| | | return asnOrderService.createByPo(ids); |
| | | // List<Long> ids = JSONArray.parseArray(params.get("ids").toString(), Long.class); |
| | | // if (ids.isEmpty()) { |
| | | // return R.error("参数不能为空"); |
| | | // } |
| | | |
| | | return asnOrderService.createByPo(params); |
| | | } |
| | | |
| | | |