| | |
| | | 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.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.manager.service.OutStockItemService; |
| | | import com.vincent.rsf.server.manager.service.OutStockService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public R save(@RequestBody AsnOrder asnOrder) { |
| | | asnOrder.setCreateBy(getLoginUserId()) |
| | | .setUpdateBy(getLoginUserId()); |
| | | if (!Objects.isNull(asnOrder.getCode())) { |
| | | String code = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, asnOrder); |
| | | asnOrder.setCode(code); |
| | | if (Objects.isNull(asnOrder.getCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, asnOrder); |
| | | if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { |
| | | return R.error("编码规则错误:编码「SYS_OUT_STOCK_CODE」是未设置成功!!"); |
| | | } |
| | | asnOrder.setCode(ruleCode); |
| | | } |
| | | if (!outStockService.save(asnOrder)) { |
| | | return R.error("Save Fail"); |
| | |
| | | asnOrder.setType(OrderType.ORDER_OUT.type) |
| | | .setUpdateBy(getLoginUserId()) |
| | | .setUpdateTime(new Date()); |
| | | if (Objects.isNull(asnOrder.getCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, asnOrder); |
| | | asnOrder.setCode(ruleCode); |
| | | } |
| | | if (!outStockService.updateById(asnOrder)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, AsnOrderTemplate.class), response); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | | @ApiOperation("通过DO单生成出库单") |
| | | @PostMapping("/outStock/generate/orders") |
| | | public R genOutStock(@RequestBody Map<String, Object> params) { |
| | | if (Objects.isNull(params.get("ids"))) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | List<Long> ids = (List<Long>) params.get("ids"); |
| | | return outStockService.genOutStock(ids); |
| | | } |
| | | |
| | | |
| | | } |