| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.MonthlySettle; |
| | | import com.zy.asrs.entity.MonthlySettleDetail; |
| | | import com.zy.asrs.entity.param.DateRangeParam; |
| | | import com.zy.asrs.entity.param.MonthlySettleQueryParam; |
| | | import com.zy.asrs.entity.result.MonthlySettleStatisticsVO; |
| | | import com.zy.asrs.service.MonthlySettleService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | public class MonthlySettleController extends BaseController { |
| | |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 导出月结明细 |
| | | */ |
| | | @RequestMapping(value = "/monthlySettle/detail/export/{id}/auth") |
| | | @ManagerAuth(memo = "导出月结明细") |
| | | public R exportDetail(@PathVariable("id") Long id) { |
| | | // 获取月结统计信息 |
| | | MonthlySettleStatisticsVO statistics = monthlySettleService.getSettleStatistics(id); |
| | | if (statistics == null) { |
| | | return R.error("月结明细不存在"); |
| | | } |
| | | |
| | | List<MonthlySettleDetail> details = statistics.getDetails() != null ? statistics.getDetails() : new ArrayList<>(); |
| | | List<com.zy.asrs.entity.result.MonthlySettleDetailFlowVO> detailFlows = statistics.getDetailFlows() != null ? statistics.getDetailFlows() : new ArrayList<>(); |
| | | |
| | | // 定义明细流水导出字段 |
| | | List<String> flowFields = new ArrayList<>(); |
| | | flowFields.add("orderNo"); |
| | | flowFields.add("orderTime"); |
| | | flowFields.add("pakinPakoutStatusName"); |
| | | flowFields.add("matnr"); |
| | | flowFields.add("maktx"); |
| | | flowFields.add("batch"); |
| | | flowFields.add("brand"); |
| | | flowFields.add("specs"); |
| | | flowFields.add("qty"); |
| | | flowFields.add("unit"); |
| | | |
| | | // 定义汇总导出字段 |
| | | List<String> summaryFields = new ArrayList<>(); |
| | | summaryFields.add("matnr"); |
| | | summaryFields.add("maktx"); |
| | | summaryFields.add("batch"); |
| | | summaryFields.add("brand"); |
| | | summaryFields.add("beginningQty"); |
| | | summaryFields.add("endingQty"); |
| | | summaryFields.add("diffQty"); |
| | | summaryFields.add("inQty"); |
| | | summaryFields.add("outQty"); |
| | | |
| | | // 构建返回数据结构:第一页是明细流水,第二页是汇总 |
| | | java.util.Map<String, Object> result = new java.util.HashMap<>(); |
| | | result.put("detailFlows", exportSupport(detailFlows, flowFields)); |
| | | result.put("details", exportSupport(details, summaryFields)); |
| | | result.put("flowTitles", new String[]{"订单编号", "业务时间", "类型", "物料编码", "物料名称", "批次", "品牌", "规格", "数量", "单位"}); |
| | | result.put("summaryTitles", new String[]{"物料编码", "物料名称", "批次", "品牌", "期初库存", "期末库存", "差异数量", "本期入库", "本期出库"}); |
| | | |
| | | return R.ok(result); |
| | | } |
| | | |
| | | } |
| | | |