ShipmentU8ContainerHeaderController.java 4.68 KB
package com.huaheng.pc.receipt.U8.controller;


import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.warehouse.domain.WorkOrderList;
import com.huaheng.pc.receipt.U8.domain.U8OutParameters;
import com.huaheng.pc.receipt.U8.domain.U8Stock;
import com.huaheng.pc.receipt.U8.domain.U8StockQuery;
import com.huaheng.pc.receipt.U8.service.IShipmentU8ContainerHeaderService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * u8出库单据 信息操作处理
 *
 * @author huaheng
 * @date 2022-03-23
 */
@Controller
@RequestMapping("/shipment/shipmentU8ContainerHeader")
public class ShipmentU8ContainerHeaderController extends BaseController
{
    private String prefix = "shipment/shipmentU8ContainerHeader";

	@Resource
	private IShipmentU8ContainerHeaderService shipmentU8ContainerHeaderService;


	@RequiresPermissions("shipment:shipmentU8ContainerHeader:view")
	@GetMapping()
	public String shipmentU8ContainerHeader()
	{
	    return prefix + "/shipmentU8ContainerHeader";
	}



//	@GetMapping("/getU8StockDataAll")
//	@ResponseBody
//	public AjaxResult getU8StockDataAll(String cCompanyCode, String cWHCode){
//		try {
//			shipmentU8ContainerHeaderService.queryStockcDataAll(cCompanyCode, cWHCode);
//		} catch (Exception e) {
//			e.printStackTrace();
//			return AjaxResult.error(e.getMessage());
//		}
//		return null;
//	}

	/**
	 * 获取库存详情
	 * @param u8StockQuery
	 * @return
	 */
	@ApiOperation("获取U8库存详情")
	@Log(title = "获取U8库存详情", action = BusinessType.OTHER)
	@PostMapping("/getU8StockData")
	@ResponseBody
    @ApiLogger(apiName = "获取U8库存详情", from = "U8")
	public AjaxResult getU8StockData(U8StockQuery u8StockQuery){
		AjaxResult ajaxResult = AjaxResult.success();
		List<U8Stock> list;
		try {
			list = shipmentU8ContainerHeaderService.getStockcData(u8StockQuery);
		} catch (Exception e) {
			return AjaxResult.error(e.getMessage());
		}
		ajaxResult.setData(list);
		return ajaxResult;
	}

    /**
     * 获取库存详情
     * @param json json数据
     * @return
     */
    @ApiOperation("批量获取U8库存详情")
    @Log(title = "获取U8库存详情", action = BusinessType.OTHER)
    @PostMapping("/getU8StockDataAll")
    @ResponseBody
    public AjaxResult getU8StockDataAll(String json){
        AjaxResult ajaxResult = AjaxResult.success();
        List<U8Stock> list;
        try {
            list = shipmentU8ContainerHeaderService.getStockcDataAll(json);
            ajaxResult.setData(list);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
        return ajaxResult;
    }

	@ApiOperation("U8出库接口")
	@Log(title = "U8出库接口", action = BusinessType.OTHER)
	@GetMapping("/workOrderOut")
	@ResponseBody
    @ApiLogger(apiName = "U8出库接口", from = "U8")
	public AjaxResult workOrderOut(String u8OutParameters){
		AjaxResult result;
		try {
			U8OutParameters outParameters = shipmentU8ContainerHeaderService.dataConversion(u8OutParameters);
			result = shipmentU8ContainerHeaderService.outStock(outParameters);
		} catch (Exception e) {
			return AjaxResult.error(e.getMessage());
		}
		return result;
	}

//    @PostMapping("/importData")
//    @ResponseBody
//    public AjaxResult importData(MultipartFile file) throws Exception {
//        List<Map<String, Object>> mapList = ExecelUtils.leading(file);
//        Boolean flag = true;
//        flag = shipmentU8ContainerHeaderService.importData(mapList,false);
//        if (flag == true) {
//            return AjaxResult.success("导入成功");
//        } else {
//            return AjaxResult.success("导入失败,数据格式不对");
//        }
//    }
//
//    /**
//     * 导出模板
//     * @return
//     * @throws Exception
//     */
//    @GetMapping("/importTemplate")
//    @ResponseBody
//    public AjaxResult importTemplate() {
//        ExcelUtilses<WorkOrderList>
//            util = new ExcelUtilses<>(WorkOrderList.class);
//        return util.importTemplateExcel("外协");
//    }


}