入库整理
parent
c7989bec9a
commit
00cfa17fe6
|
|
@ -48,11 +48,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author liuxue
|
||||
* @website https://eladmin.vip
|
||||
* @date 2023-07-28
|
||||
**/
|
||||
@RestController
|
||||
|
|
@ -67,6 +68,7 @@ public class StockController {
|
|||
private final FileProperties properties;
|
||||
|
||||
private final StockTypeService stockTypeService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
|
|
@ -150,8 +152,8 @@ public class StockController {
|
|||
@ApiOperation("查询可用空闲的容器stock")
|
||||
@GetMapping(value = "/queryKyStockList")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> queryKyStockList(StockQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(stockService.queryKyStockList("124"),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryKyStockList(StockQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(stockService.queryKyStockList(criteria.getCode()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ public class Asn extends BaseEntity implements Serializable {
|
|||
private String code;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`area_id`",nullable = false)
|
||||
@NotNull
|
||||
@JoinColumn(name = "`area_id`")
|
||||
@ApiModelProperty(value = "库区")
|
||||
private Area area;
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ public class Asn extends BaseEntity implements Serializable {
|
|||
private String status;
|
||||
|
||||
@Column(name = "`cus_code`")
|
||||
@ApiModelProperty(value = "客户订单号")
|
||||
@ApiModelProperty(value = "SAP接口号")
|
||||
private String cusCode;
|
||||
|
||||
@Column(name = "`related_bill1`")
|
||||
|
|
@ -106,11 +105,11 @@ public class Asn extends BaseEntity implements Serializable {
|
|||
private String fromTel;
|
||||
|
||||
@Column(name = "`order_quantity`")
|
||||
@ApiModelProperty(value = "订单数量")
|
||||
@ApiModelProperty(value = "待收数量")
|
||||
private Double orderQuantity;
|
||||
|
||||
@Column(name = "`received_quantity`")
|
||||
@ApiModelProperty(value = "收货数量")
|
||||
@ApiModelProperty(value = "已收数量")
|
||||
private Double receivedQuantity;
|
||||
|
||||
@Column(name = "`putaway_quantity`")
|
||||
|
|
@ -136,14 +135,14 @@ public class Asn extends BaseEntity implements Serializable {
|
|||
private String description;
|
||||
|
||||
@Column(name = "`zl_by`")
|
||||
@ApiModelProperty(value = "整理人")
|
||||
@ApiModelProperty(value = "SAP收货人")
|
||||
private String zlBy;
|
||||
|
||||
@Column(name = "`zl_date`")
|
||||
@ApiModelProperty(value = "整理日期")
|
||||
private Timestamp zlDate;
|
||||
@Column(name = "`cy_by`")
|
||||
@ApiModelProperty(value = "抽样人")
|
||||
@ApiModelProperty(value = "申请人")
|
||||
private String cyBy;
|
||||
|
||||
@Column(name = "`cy_date`")
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class AsnDetail extends BaseEntity implements Serializable {
|
|||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "`asn_id`")
|
||||
@ApiModelProperty(value = "订单序号")
|
||||
@ApiModelProperty(value = "入库单")
|
||||
private Asn asn;
|
||||
|
||||
@OneToOne
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.youchain.businessdata.repository.AsnRepository;
|
|||
import com.youchain.businessdata.service.AsnService;
|
||||
import com.youchain.businessdata.service.dto.AsnQueryCriteria;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.CodeUtils;
|
||||
import com.youchain.utils.SecurityUtils;
|
||||
|
|
@ -89,7 +90,6 @@ public class AsnController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getIdByAsn")
|
||||
@Log("查询asn")
|
||||
@ApiOperation("查询asn")
|
||||
|
|
@ -132,6 +132,22 @@ public class AsnController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteAsnAndDetail")
|
||||
@Log("删除入库单和入库明细")
|
||||
@ApiOperation("删除入库单和入库明细")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> deleteAsnAndDetail(@RequestBody Long[] ids) {
|
||||
try {
|
||||
for (Long id : ids) {
|
||||
asnService.deleteAsnAndDetail(id);
|
||||
}
|
||||
return new ResponseEntity<>(ApiResult.success("删除成功", null), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(HttpStatus.BAD_REQUEST.value(), e.getMessage(), null), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/zlRegister")
|
||||
@Log("入库整理登记")
|
||||
@ApiOperation("入库整理登记")
|
||||
|
|
@ -184,6 +200,7 @@ public class AsnController {
|
|||
}
|
||||
return new ResponseEntity<>("操作成功", HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/zjRegister")
|
||||
@Log("入库质检登记")
|
||||
@ApiOperation("入库质检登记")
|
||||
|
|
|
|||
|
|
@ -149,9 +149,6 @@ public class AsnDetailController {
|
|||
@ApiOperation("新增asn_detail")
|
||||
@PreAuthorize("@el.check('super:man')")
|
||||
public ResponseEntity<Object> createAsnDetail(@Validated @RequestBody AsnDetail asnDetail) {
|
||||
if(asnDetail.getAsn()==null){
|
||||
return new ResponseEntity<>(ApiResult.fail(HttpStatus.BAD_REQUEST.value(), "请先提交入库单!", null),HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
asnDetail.setStatus(BizStatus.OPEN);
|
||||
asnDetail.setDept(UserUtils.getDept());
|
||||
if (asnDetail.getRemark() == null && asnDetail.getAsn().getDescription() != null) {
|
||||
|
|
|
|||
|
|
@ -82,4 +82,10 @@ public interface AsnService {
|
|||
* @throws Exception /
|
||||
*/
|
||||
void download(List<AsnDto> all, HttpServletResponse response) throws Exception, Exception;
|
||||
|
||||
/**
|
||||
* 删除asn和asnDetail
|
||||
* @param id
|
||||
*/
|
||||
void deleteAsnAndDetail(Long id);
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import com.youchain.businessdata.domain.Asn;
|
|||
import com.youchain.businessdata.domain.AsnDetail;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.service.AsnDetailService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.AsnRepository;
|
||||
|
|
@ -147,4 +148,18 @@ public class AsnServiceImpl implements AsnService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAsnAndDetail(Long id) {
|
||||
Asn asn = asnRepository.findById(id).get();
|
||||
if (!BizStatus.OPEN.equals(asn.getStatus())) {
|
||||
throw new BadRequestException("该单据状态不允许删除");
|
||||
}
|
||||
List<AsnDetail> asnDetails = asnDetailRepository.queryByAsnId(id);
|
||||
for (AsnDetail asnDetail : asnDetails) {
|
||||
asnDetailRepository.delete(asnDetail);
|
||||
}
|
||||
asnRepository.delete(asn);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue