|  | @@ -0,0 +1,174 @@
 | 
	
		
			
				|  |  | +package com.ruoyi.web.controller.warehouse.appHold;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import cn.hutool.core.util.ObjectUtil;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import com.github.pagehelper.PageHelper;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.service.ITCorpsService;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.service.ITGoodsService;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.page.TableDataInfo;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitemsElabel;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.domain.vo.AppHoldTWarehouseBillsRVO;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.service.ITWarehousebillsitemsElabelService;
 | 
	
		
			
				|  |  | +import com.ruoyi.warehouseBusiness.service.ITWarehousebillsitemsService;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@Api(value = "app手持相关接口")
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +@RequestMapping("/api/appHold/warehouseBills")
 | 
	
		
			
				|  |  | +public class AppWarehouseController extends BaseController {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ITWarehouseBillsService itWarehouseBillsService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ITWarehousebillsitemsService itWarehousebillsitemsService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ITCorpsService itCorpsService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ITGoodsService itGoodsService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ITWarehousebillsitemsElabelService labelService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查询入/出库列表数据
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("查询入/出库列表数据")
 | 
	
		
			
				|  |  | +    @GetMapping("/list")
 | 
	
		
			
				|  |  | +    public TableDataInfo inList(@RequestParam(value = "storekeeper") String storekeeper,
 | 
	
		
			
				|  |  | +                                @RequestParam(value = "billtype") String billtype,
 | 
	
		
			
				|  |  | +                                @RequestParam(value = "pageNum") Integer pageNum,
 | 
	
		
			
				|  |  | +                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
 | 
	
		
			
				|  |  | +        //返回数据集
 | 
	
		
			
				|  |  | +        List<Map<String, Object>> mapList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        //获取入/出数据集
 | 
	
		
			
				|  |  | +        TWarehouseBills warehouseBills = new TWarehouseBills();
 | 
	
		
			
				|  |  | +        warehouseBills.setfBilltype(billtype);
 | 
	
		
			
				|  |  | +        warehouseBills.setfStorekeeper(storekeeper);
 | 
	
		
			
				|  |  | +        PageHelper.startPage(pageNum, pageSize);
 | 
	
		
			
				|  |  | +        List<TWarehouseBills> warehouseBillsList = itWarehouseBillsService.selectTWarehousebillsList(warehouseBills);
 | 
	
		
			
				|  |  | +        //遍历集合  查询明细数据集
 | 
	
		
			
				|  |  | +        warehouseBillsList.forEach(ware -> {
 | 
	
		
			
				|  |  | +            Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +            map.put("fId", ware.getfId());
 | 
	
		
			
				|  |  | +            map.put("fBillno", ware.getfBillno());
 | 
	
		
			
				|  |  | +            TWarehousebillsitems tWarehousebillsitems = new TWarehousebillsitems();
 | 
	
		
			
				|  |  | +            tWarehousebillsitems.setfPid(ware.getfId());
 | 
	
		
			
				|  |  | +            List<TWarehousebillsitems> tWarehousebillsitemsList = itWarehousebillsitemsService.selectTWarehousebillsitemsList(tWarehousebillsitems);
 | 
	
		
			
				|  |  | +            List<AppHoldTWarehouseBillsRVO> appHoldTWarehouseBillsRVOList = new ArrayList<>();
 | 
	
		
			
				|  |  | +            //遍历明细集合 取出所需要数据放到返回类中
 | 
	
		
			
				|  |  | +            tWarehousebillsitemsList.forEach(ls -> {
 | 
	
		
			
				|  |  | +                AppHoldTWarehouseBillsRVO appHoldTWarehouseBillsRVO = new AppHoldTWarehouseBillsRVO();
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setItemId(ls.getfId());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFBsdate(ls.getfBsdate());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFWarehouseInformation(ls.getfWarehouseInformation());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFGrossweight(ls.getfGrossweight());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFMblno(ware.getfMblno());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFName(itCorpsService.selectCorpsById(ls.getfGoodsid()) == null ? "无" : itCorpsService.selectCorpsById(ls.getfGoodsid()).getfName());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFNetweight(ls.getfNetweight());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setGoodsName(itGoodsService.selectTGoodsById(ls.getfGoodsid()) == null ? "无" : itGoodsService.selectTGoodsById(ls.getfGoodsid()).getfName());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFQty(ls.getfQty());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVOList.add(appHoldTWarehouseBillsRVO);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            map.put("itemList", appHoldTWarehouseBillsRVOList);
 | 
	
		
			
				|  |  | +            mapList.add(map);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return getDataTable(mapList);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取入库仓库详细信息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("获取入/出库仓库标签列表数据")
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/labelList")
 | 
	
		
			
				|  |  | +    public AjaxResult getLabelList(@RequestParam(value = "fId") Long fId,
 | 
	
		
			
				|  |  | +                                   @RequestParam(value = "itemId") Long itemId) {
 | 
	
		
			
				|  |  | +        return AjaxResult.success(labelService.selectItemsElabelList(fId, itemId));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取入库仓库详细信息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("获取入/出库仓库详细信息")
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/details")
 | 
	
		
			
				|  |  | +    public AjaxResult getInfo(@RequestParam(value = "labelId") Long labelId) {
 | 
	
		
			
				|  |  | +        Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +        //判断标签id是否存在
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotNull(labelId)) {
 | 
	
		
			
				|  |  | +            TWarehousebillsitemsElabel tWarehousebillsitemsElabel = labelService.selectByfId(labelId);
 | 
	
		
			
				|  |  | +            //判断能否找到标签数据
 | 
	
		
			
				|  |  | +            if (ObjectUtil.isNotNull(tWarehousebillsitemsElabel)) {
 | 
	
		
			
				|  |  | +                TWarehouseBills tWarehouseBills = itWarehouseBillsService.selectTWarehousebillsByIdHold(tWarehousebillsitemsElabel.getfGPid());
 | 
	
		
			
				|  |  | +                TWarehousebillsitems tWarehousebillsitems = itWarehousebillsitemsService.selectTWarehousebillsitemsById(tWarehousebillsitemsElabel.getfPid());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                AppHoldTWarehouseBillsRVO appHoldTWarehouseBillsRVO = new AppHoldTWarehouseBillsRVO();
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setItemId(tWarehousebillsitems.getfId());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFBsdate(tWarehousebillsitems.getfBsdate());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFWarehouseInformation(tWarehousebillsitems.getfWarehouseInformation());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFGrossweight(tWarehousebillsitems.getfGrossweight());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFMblno(tWarehousebillsitems.getfMblno());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFName(itCorpsService.selectCorpsById(tWarehousebillsitems.getfGoodsid()) == null ? "无" : itCorpsService.selectCorpsById(tWarehousebillsitems.getfGoodsid()).getfName());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFNetweight(tWarehousebillsitems.getfNetweight());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setGoodsName(itGoodsService.selectTGoodsById(tWarehousebillsitems.getfGoodsid()) == null ? "无" : itGoodsService.selectTGoodsById(tWarehousebillsitems.getfGoodsid()).getfName());
 | 
	
		
			
				|  |  | +                appHoldTWarehouseBillsRVO.setFQty(tWarehousebillsitems.getfQty());
 | 
	
		
			
				|  |  | +                map.put("item", appHoldTWarehouseBillsRVO);
 | 
	
		
			
				|  |  | +                map.put("fBillno", tWarehouseBills.getfBillno());
 | 
	
		
			
				|  |  | +                return AjaxResult.success(map);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                return AjaxResult.error("该标签详情不存在");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("请选择标签号");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 待入出库 提交
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("待入出库 提交")
 | 
	
		
			
				|  |  | +    @PostMapping(value = "/ischargeCargo")
 | 
	
		
			
				|  |  | +    public AjaxResult ischargeCargo(@RequestBody TWarehousebillsitems tWarehousebillsitems) {
 | 
	
		
			
				|  |  | +        tWarehousebillsitems.setfBillstatus(30L);
 | 
	
		
			
				|  |  | +        return itWarehouseBillsService.waitWarehousingItems(tWarehousebillsitems);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 确认入库、出库
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("确认入库、出库")
 | 
	
		
			
				|  |  | +    @PostMapping(value = "/appOperationConfirmation")
 | 
	
		
			
				|  |  | +    public AjaxResult warehouseOperationConfirmation(@RequestBody String information) {
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(information)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("未找到查询条件,请确认");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        JSONObject jsonObject = JSONArray.parseObject(information);
 | 
	
		
			
				|  |  | +        String item = jsonObject.get("item").toString();
 | 
	
		
			
				|  |  | +        String attachs = jsonObject.get("attachs").toString();
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(item) || "{}".equals(item)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("未找到明细信息,请确认");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return itWarehouseBillsService.warehouseOperationConfirmation(item, attachs);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 |