中微测试

main
FOAM 2024-09-09 13:45:39 +08:00
parent 3dbc54b2bc
commit b24d380b8e
11 changed files with 249 additions and 25 deletions

View File

@ -78,6 +78,18 @@ public class BillType extends BaseEntity implements Serializable {
@ApiModelProperty(value = "来源序号")
private Long sourceId;
@Column(name = "`bezj`")
@ApiModelProperty(value = "质检")
private Boolean bezj=false;
@Column(name = "`bezl`")
@ApiModelProperty(value = "整理")
private Boolean bezl=false;
@Column(name = "`becy`")
@ApiModelProperty(value = "抽样")
private Boolean becy=false;
public void copy(BillType source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@ -75,6 +75,23 @@ public class Item extends BaseEntity implements Serializable {
@ApiModelProperty(value = "是否失效")
private Boolean enabled=true;
@Column(name = "`bepc`")
@ApiModelProperty(value = "批次")
private Boolean bepc=false;
@Column(name = "`bexq`")
@ApiModelProperty(value = "效期")
private Boolean bexq=false;
@Column(name = "`beds`")
@ApiModelProperty(value = "多收")
private Boolean beds=false;
@Column(name = "`becf`")
@ApiModelProperty(value = "超发")
private Boolean becf=false;
@Column(name = "`valid_period`")
@ApiModelProperty(value = "保质期")
private Integer validPeriod;
@ -217,6 +234,8 @@ public class Item extends BaseEntity implements Serializable {
@ApiModelProperty(value = "库位")
private Point point;
public void copy(Item source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@ -74,6 +74,15 @@ public class BillTypeController {
return new ResponseEntity<>(billTypeService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping(value ="/getBillTypes")
@Log("加载下拉框BillType")
@ApiOperation("queryAreaList")
@PreAuthorize("@el.check('super:man')")
public ResponseEntity<Object> getBillTypes(@RequestBody BillTypeQueryCriteria criteria){
return new ResponseEntity<>(billTypeService.queryAll(criteria),HttpStatus.OK);
}
@PostMapping
@Log("新增bill_type")
@ApiOperation("新增bill_type")

View File

@ -17,7 +17,10 @@ package com.youchain.basicdata.service.dto;
import com.youchain.modules.system.domain.Dept;
import com.youchain.modules.system.service.dto.DeptSmallDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.sql.Timestamp;
import java.io.Serializable;
@ -57,6 +60,15 @@ public class BillTypeDto implements Serializable {
/** 来源序号 */
private Long sourceId;
/** 质检 */
private Boolean bezj;
/** 整理 */
private Boolean bezl;
/** 抽样 */
private Boolean becy;
/** 创建人 */
private String createBy;

View File

@ -156,4 +156,16 @@ public class ItemDto implements Serializable {
private PointDto point;
/** 批次 */
private Boolean bepc;
/** 效期 */
private Boolean bexq;
/** 多收 */
private Boolean beds;
/** 超发 */
private Boolean becf;
}

View File

@ -135,6 +135,28 @@ public class Asn extends BaseEntity implements Serializable {
@ApiModelProperty(value = "备注")
private String description;
@Column(name = "`zl_by`")
@ApiModelProperty(value = "整理人")
private String zlBy;
@Column(name = "`zl_date`")
@ApiModelProperty(value = "整理日期")
private Timestamp zlDate;
@Column(name = "`cy_by`")
@ApiModelProperty(value = "抽样人")
private String cyBy;
@Column(name = "`cy_date`")
@ApiModelProperty(value = "抽样日期")
private Timestamp cyDate;
@Column(name = "`zj_by`")
@ApiModelProperty(value = "质检人")
private String zjBy;
@Column(name = "`zj_date`")
@ApiModelProperty(value = "质检日期")
private Timestamp zjDate;
public void copy(Asn source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@ -15,25 +15,32 @@
*/
package com.youchain.businessdata.rest;
import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.BillType;
import com.youchain.basicdata.service.dto.BillTypeQueryCriteria;
import com.youchain.businessdata.domain.Asn;
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.utils.BizStatus;
import com.youchain.utils.CodeUtils;
import com.youchain.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
@ -124,4 +131,87 @@ public class AsnController {
asnService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/zlRegister")
@Log("入库整理登记")
@ApiOperation("入库整理登记")
@PreAuthorize("@el.check('super:man')")
@Transactional
@DuplicateSubmission(5)
public ResponseEntity<Object> zlRegister(@RequestBody Long[] ids) {
for (Long id : ids) {
Asn asn=asnService.getEntity(id);
BillType bt=asn.getBillType();
if(bt.getBezl()){
if(!asn.getStatus().equals(BizStatus.OPEN)){
throw new BadRequestException(asn.getCode()+"状态不正确,打开状态才能操作");
}
asn.setZlBy(SecurityUtils.getCurrentUsername());
asn.setZlDate(new Timestamp(new Date().getTime()));
asn.setStatus(BizStatus.ZL);
asnService.update(asn);
}else{
throw new BadRequestException(asn.getCode()+"不需要整理");
}
}
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
@PostMapping("/cyRegister")
@Log("入库抽样登记")
@ApiOperation("入库抽样登记")
@PreAuthorize("@el.check('super:man')")
@Transactional
@DuplicateSubmission(5)
public ResponseEntity<Object> cyRegister(@RequestBody Long[] ids) {
for (Long id : ids) {
Asn asn=asnService.getEntity(id);
BillType bt=asn.getBillType();
if(bt.getBezl()&&asn.getZlBy()==null){
throw new BadRequestException(asn.getCode()+"该单子还未整理,请先整理");
}
if(bt.getBecy()){
if(!asn.getStatus().equals(BizStatus.OPEN)&&!asn.getStatus().equals(BizStatus.ZL)){
throw new BadRequestException(asn.getCode()+"状态不正确,打开或整理状态才能操作");
}
asn.setCyBy(SecurityUtils.getCurrentUsername());
asn.setCyDate(new Timestamp(new Date().getTime()));
asn.setStatus(BizStatus.CY);
asnService.update(asn);
}else{
throw new BadRequestException(asn.getCode()+"不需要抽样");
}
}
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
@PostMapping("/zjRegister")
@Log("入库质检登记")
@ApiOperation("入库质检登记")
@PreAuthorize("@el.check('super:man')")
@Transactional
@DuplicateSubmission(5)
public ResponseEntity<Object> zjRegister(@RequestBody Long[] ids) {
for (Long id : ids) {
Asn asn=asnService.getEntity(id);
BillType bt=asn.getBillType();
if(bt.getBezl()&&asn.getZlBy()==null){
throw new BadRequestException(asn.getCode()+"该单子还未整理,请先整理");
}
if(bt.getBecy()&&asn.getCyBy()==null){
throw new BadRequestException(asn.getCode()+"该单子还未抽样,请先抽样");
}
if(bt.getBezj()){
if(!asn.getStatus().equals(BizStatus.OPEN)&&!asn.getStatus().equals(BizStatus.ZL)&&!asn.getStatus().equals(BizStatus.CY)){
throw new BadRequestException(asn.getCode()+"状态不正确,打开或整理或抽样状态才能操作");
}
asn.setZjBy(SecurityUtils.getCurrentUsername());
asn.setZjDate(new Timestamp(new Date().getTime()));
asn.setStatus(BizStatus.ZJ);
asnService.update(asn);
}else{
throw new BadRequestException(asn.getCode()+"不需要质检");
}
}
return new ResponseEntity<>("操作成功",HttpStatus.OK);
}
}

View File

@ -20,12 +20,15 @@ import com.alibaba.fastjson.JSONObject;
import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.*;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.repository.StockRepository;
import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.ItemService;
import com.youchain.basicdata.service.StockService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.AreaDto;
import com.youchain.basicdata.service.dto.BillTypeDto;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.mapstruct.PointMapper;
import com.youchain.businessdata.inputJson.IRkConfirm;
import com.youchain.businessdata.inputJson.IRkInv;
@ -106,6 +109,7 @@ public class AsnDetailController {
private final InventoryMapper inventoryMapper;
private final XppRecordRepository xppRecordRepository;
private final XppRecordService xppRecordService;
private final PointRepository pointRepository;
@Log("导出数据")
@ApiOperation("导出数据")
@ -467,17 +471,28 @@ public class AsnDetailController {
@Transactional(rollbackFor = Exception.class)
public ApiResult invVerify(@RequestBody Long[] ids) {
for (Long id : ids) {
AsnDto byId = asnService.findById(id);
if (Objects.isNull(byId)) {
Asn asn=asnService.getEntity(id);
//AsnDto asnDto = asnService.findById(id);
if (Objects.isNull(asn)) {
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "未查到该数据");
}
//库区的判断
AreaDto area = byId.getArea();
Area area = asn.getArea();
if (Objects.isNull(area)) {
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写");
}
BillType bt=asn.getBillType();
if (bt.getBezl() && asn.getZlBy() == null) {
throw new BadRequestException(asn.getCode() + "该单子还未整理,请先整理");
}
if (bt.getBecy() && asn.getCyBy() == null) {
throw new BadRequestException(asn.getCode() + "该单子还未抽样,请先抽样");
}
if(bt.getBezj()&& asn.getZjBy() == null) {
throw new BadRequestException(asn.getCode() + "该单子还未质检,请先质检");
}
// if (!area.getBesh()){
// // 通用异常,使用自定义状态码
// throw new BadRequestException(HttpStatus.NOT_FOUND,id+"的库区的仓库不是接收仓库");
@ -503,33 +518,31 @@ public class AsnDetailController {
}
}
ApiResult apiResult = null;
if (Objects.isNull( asnDetailData.getPoint())){
// apiResult = this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), null);
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, asnDetailData.getId() + "没有填写点位");
}else {
if (asnDetailData.getReceivedQty()>0){
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库");
}
this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), asnDetailData.getPoint().getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null);
}
if (asnDetailData.getReceivedQty()>0){
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库");
}
Point p=asnDetailData.getPoint();
if(p==null){
p=pointRepository.findByCode("MR-CH");
}
apiResult=this.putawayInv(asnDetailData.getId(), asn.getArea().getId(), p.getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null);
if (apiResult.getStatus() == 200) {
//收货日期改成当前日期 数量累计
byId.setReceivedDate(new Timestamp(System.currentTimeMillis()));
byId.setReceivedQuantity(byId.getReceivedQuantity() + asnDetailData.getOrderQty());
asn.setReceivedDate(new Timestamp(System.currentTimeMillis()));
//asn.setReceivedQuantity(asn.getReceivedQuantity() + asnDetailData.getOrderQty());
} else {
// 通用异常,使用自定义状态码
throw new BadRequestException(HttpStatus.NOT_FOUND, apiResult.getMessage());
}
double pd = byId.getOrderQuantity() - byId.getReceivedQuantity();
double pd = asn.getOrderQuantity() - asn.getReceivedQuantity();
if (pd == 0) {
byId.setStatus(BizStatus.RECEIVED);
} else if (pd > 0 && byId.getReceivedQuantity() > 0) {
byId.setStatus(BizStatus.RECEIVING);
asn.setStatus(BizStatus.RECEIVED);
} else if (pd > 0 && asn.getReceivedQuantity() > 0) {
asn.setStatus(BizStatus.RECEIVING);
}
asnService.update(asnMapper.toEntity(byId));
asnService.update(asn);
}
}
}
@ -537,12 +550,14 @@ public class AsnDetailController {
}
public void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId,double recQty,String ewm) {
public ApiResult putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId,double recQty,String ewm) {
AsnDetail d = asnDetailService.getEntity(asnDetailId);
Area area = areaService.findEntityById(areaId);
Point point = null;
if(pointId!=null){
point = pointService.findEntityById(pointId);
}else{
point =pointRepository.findByCode("MR-CH");
}
Point zzkw=null;
if(area.getBexb()){
@ -557,7 +572,7 @@ public class AsnDetailController {
throw new BadRequestException("请选择入库库位");
}
double unRecQty=d.getOrderQty() - d.getReceivedQty();
if ( recQty<=unRecQty) {
if ( recQty<=unRecQty||d.getItem().getBeds()) {
String pc1=null;
//现品票确认将任务id回写到现品票表中
XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
@ -611,6 +626,8 @@ public class AsnDetailController {
} else {
throw new BadRequestException(d.getItem().getCode() + "收货数量不能大于未收数量");
}
return ApiResult.result(200,"" , HttpStatus.OK);
}
}

View File

@ -110,4 +110,20 @@ public class AsnDto implements Serializable {
/** 修改时间 */
private Timestamp updateTime;
/** 整理人 */
private String zlBy;
/** 整理时间 */
private Timestamp zlDate;
/** 抽样人 */
private String cyBy;
/** 抽样时间 */
private Timestamp cyDate;
/** 质检人 */
private String zjBy;
/** 质检时间 */
private Timestamp zjDate;
}

View File

@ -10,6 +10,21 @@ public class BizStatus {
*/
public static String OPEN = "OPEN";
/**
*
*/
public static String ZL = "ZL";
/**
*
*/
public static String CY = "CY";
/**
*
*/
public static String ZJ = "ZJ";
/**
*
*/

View File

@ -7,8 +7,8 @@ spring:
freemarker:
check-template-location: false
profiles:
#active: prod
active: dev
active: prod
#active: dev
jackson:
time-zone: GMT+8
data: