产品入库,半成品委外单
This commit is contained in:
@@ -15,14 +15,19 @@ import com.gear.oa.domain.bo.GearStockIoOrderWithDetailBo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderVo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderWithDetailVo;
|
||||
import com.gear.oa.service.IGearStockIoOrderService;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -55,6 +60,187 @@ public class GearStockIoOrderController extends BaseController {
|
||||
return R.ok(stockIoOrderService.queryMaterialFlow(itemId, startTime, endTime));
|
||||
}
|
||||
|
||||
@Log(title = "物料出入库统计", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/materialFlow/export")
|
||||
public void exportMaterialFlow(@NotNull(message = "物料ID不能为空") @RequestParam Long itemId,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
|
||||
HttpServletResponse response) {
|
||||
IGearStockIoOrderService.MaterialFlowResp resp = stockIoOrderService.queryMaterialFlow(itemId, startTime, endTime);
|
||||
List<MaterialFlowExportRow> exportRows = new ArrayList<>();
|
||||
|
||||
MaterialFlowExportRow summary = new MaterialFlowExportRow();
|
||||
summary.setItemId(resp.getItemId());
|
||||
summary.setStartTime(resp.getStartTime());
|
||||
summary.setEndTime(resp.getEndTime());
|
||||
summary.setAction("汇总");
|
||||
summary.setConfirmInQty(nz(resp.getConfirmInQty()));
|
||||
summary.setOutQty(nz(resp.getOutQty()));
|
||||
summary.setRevokeInQty(nz(resp.getRevokeInQty()));
|
||||
summary.setRevokeOutQty(nz(resp.getRevokeOutQty()));
|
||||
summary.setNetQty(nz(resp.getNetQty()));
|
||||
exportRows.add(summary);
|
||||
|
||||
if (resp.getRows() != null) {
|
||||
for (IGearStockIoOrderService.MaterialFlowRow r : resp.getRows()) {
|
||||
MaterialFlowExportRow row = new MaterialFlowExportRow();
|
||||
row.setItemId(resp.getItemId());
|
||||
row.setTime(r.getTime());
|
||||
row.setAction(r.getAction());
|
||||
row.setOrderCode(r.getOrderCode());
|
||||
row.setIoType(r.getIoType());
|
||||
row.setQtyChange(r.getQtyChange());
|
||||
exportRows.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil.exportExcel(exportRows, "物料出入库统计", MaterialFlowExportRow.class, response);
|
||||
}
|
||||
|
||||
private static BigDecimal nz(BigDecimal v) {
|
||||
return v == null ? BigDecimal.ZERO : v;
|
||||
}
|
||||
|
||||
@ExcelIgnoreUnannotated
|
||||
public static class MaterialFlowExportRow {
|
||||
@ExcelProperty(value = "物料ID")
|
||||
private Long itemId;
|
||||
@ExcelProperty(value = "开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
@ExcelProperty(value = "结束时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
@ExcelProperty(value = "确认入库汇总")
|
||||
private BigDecimal confirmInQty;
|
||||
@ExcelProperty(value = "出库汇总")
|
||||
private BigDecimal outQty;
|
||||
@ExcelProperty(value = "撤回入库汇总")
|
||||
private BigDecimal revokeInQty;
|
||||
@ExcelProperty(value = "撤回出库汇总")
|
||||
private BigDecimal revokeOutQty;
|
||||
@ExcelProperty(value = "净变动汇总")
|
||||
private BigDecimal netQty;
|
||||
@ExcelProperty(value = "明细时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date time;
|
||||
@ExcelProperty(value = "动作")
|
||||
private String action;
|
||||
@ExcelProperty(value = "单号")
|
||||
private String orderCode;
|
||||
@ExcelProperty(value = "类型")
|
||||
private String ioType;
|
||||
@ExcelProperty(value = "数量变化")
|
||||
private BigDecimal qtyChange;
|
||||
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public BigDecimal getConfirmInQty() {
|
||||
return confirmInQty;
|
||||
}
|
||||
|
||||
public void setConfirmInQty(BigDecimal confirmInQty) {
|
||||
this.confirmInQty = confirmInQty;
|
||||
}
|
||||
|
||||
public BigDecimal getOutQty() {
|
||||
return outQty;
|
||||
}
|
||||
|
||||
public void setOutQty(BigDecimal outQty) {
|
||||
this.outQty = outQty;
|
||||
}
|
||||
|
||||
public BigDecimal getRevokeInQty() {
|
||||
return revokeInQty;
|
||||
}
|
||||
|
||||
public void setRevokeInQty(BigDecimal revokeInQty) {
|
||||
this.revokeInQty = revokeInQty;
|
||||
}
|
||||
|
||||
public BigDecimal getRevokeOutQty() {
|
||||
return revokeOutQty;
|
||||
}
|
||||
|
||||
public void setRevokeOutQty(BigDecimal revokeOutQty) {
|
||||
this.revokeOutQty = revokeOutQty;
|
||||
}
|
||||
|
||||
public BigDecimal getNetQty() {
|
||||
return netQty;
|
||||
}
|
||||
|
||||
public void setNetQty(BigDecimal netQty) {
|
||||
this.netQty = netQty;
|
||||
}
|
||||
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getOrderCode() {
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
public void setOrderCode(String orderCode) {
|
||||
this.orderCode = orderCode;
|
||||
}
|
||||
|
||||
public String getIoType() {
|
||||
return ioType;
|
||||
}
|
||||
|
||||
public void setIoType(String ioType) {
|
||||
this.ioType = ioType;
|
||||
}
|
||||
|
||||
public BigDecimal getQtyChange() {
|
||||
return qtyChange;
|
||||
}
|
||||
|
||||
public void setQtyChange(BigDecimal qtyChange) {
|
||||
this.qtyChange = qtyChange;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/{orderId}")
|
||||
public R<GearStockIoOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
return R.ok(stockIoOrderService.queryById(orderId));
|
||||
|
||||
Reference in New Issue
Block a user