Jelajahi Sumber

仓库app手持接口
2022年8月9日17时03分

纪新园 3 tahun lalu
induk
melakukan
1f01ad2b1c

+ 174 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/appHold/AppWarehouseController.java

@@ -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);
+    }
+
+}

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -24,6 +24,14 @@ public interface ITCorpsService {
     public Map<String, Object> selectTCorpsById(Long fId);
 
     /**
+     * 查询客户详情通过id
+     *
+     * @param fId 客户详情ID
+     * @return 客户详情集合
+     */
+    public TCorps selectCorpsById(Long fId);
+
+    /**
      * 查询客户详情列表
      *
      * @param tCorps 客户详情

+ 11 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -89,6 +89,17 @@ public class TCorpsServiceImpl implements ITCorpsService {
     }
 
     /**
+     * 查询客户详情通过id
+     *
+     * @param fId 客户详情ID
+     * @return 客户详情集合
+     */
+    @Override
+    public TCorps selectCorpsById(Long fId) {
+        return tCorpsMapper.selectTCorpsById(fId);
+    }
+
+    /**
      * 查询客户详情列表
      *
      * @param tCorps 客户详情

+ 58 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/AppHoldTWarehouseBillsRVO.java

@@ -0,0 +1,58 @@
+package com.ruoyi.warehouseBusiness.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+@Data
+public class AppHoldTWarehouseBillsRVO {
+
+    /**
+     * 明细id
+     */
+    private Long itemId;
+
+    /**
+     * 提单号
+     */
+    private String fMblno;
+
+    /**
+     * 客户名称
+     */
+    private String fName;
+
+    /**
+     * 入库日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date fBsdate;
+
+    /**
+     * 货物名称
+     */
+    private String goodsName;
+
+    /**
+     * 库区
+     */
+    private String fWarehouseInformation;
+
+    /**
+     * 件数
+     */
+    private Long fQty;
+
+    /**
+     * 净重
+     */
+    private BigDecimal fNetweight;
+
+    /**
+     * 毛重
+     */
+    private BigDecimal fGrossweight;
+}

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsElabelMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitemsElabel;
 import org.apache.ibatis.annotations.MapKey;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -74,4 +75,11 @@ public interface TWarehousebillsitemsElabelMapper {
      */
     List<TWarehousebillsitemsElabel> selectByStockId(Long stockId);
 
+    /**
+     * app手持通过出入库主表id与明细从表id查询标签数据
+     * @param fId  出入库主表id
+     * @param itemId   明细从表id
+     * @return
+     */
+    List<TWarehousebillsitemsElabel> selectItemsElabelList(@Param(value = "fId") Long fId, @Param(value = "itemId")Long itemId);
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -33,6 +33,13 @@ public interface ITWarehouseBillsService {
     public Map<String, Object> selectTWarehousebillsById(Long fId);
 
     /**
+     * app手持获取主表详情
+     * @param fId  id
+     * @return
+     */
+    TWarehouseBills selectTWarehousebillsByIdHold(Long fId);
+
+    /**
      * 查询凯和订单数据主表
      *
      * @param fId 详情主表ID

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsitemsElabelService.java

@@ -22,4 +22,14 @@ public interface ITWarehousebillsitemsElabelService {
      * 根据父级的父级 id 获取数据
      */
     List<TWarehousebillsitemsElabel> selectByStockId(Long stockId);
+
+    /**
+     * app手持通过出入库主表id与明细从表id查询标签数据
+     * @param fId  出入库主表id
+     * @param itemId   明细从表id
+     * @return
+     */
+    List<TWarehousebillsitemsElabel> selectItemsElabelList(Long fId,Long itemId);
+
+    TWarehousebillsitemsElabel selectByfId(Long labelId);
 }

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -430,6 +430,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         return map;
     }
 
+    /**
+     * app手持获取主表详情
+     * @param fId  id
+     * @return
+     */
+    @Override
+    public TWarehouseBills selectTWarehousebillsByIdHold(Long fId) {
+        return tWarehouseBillsMapper.selectTWarehousebillsById(fId);
+    }
+
     @Override
     public AjaxResult selectTWarehousebills(Long fId) {
         TWarehouseBills warehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(fId);

+ 16 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsitemsElabelServiceImpl.java

@@ -54,4 +54,20 @@ public class TWarehousebillsitemsElabelServiceImpl implements ITWarehousebillsit
     public List<TWarehousebillsitemsElabel> selectByStockId(Long stockId) {
         return elabelMapper.selectByStockId(stockId);
     }
+
+    /**
+     * app手持通过出入库主表id与明细从表id查询标签数据
+     * @param fId  出入库主表id
+     * @param itemId   明细从表id
+     * @return
+     */
+    @Override
+    public List<TWarehousebillsitemsElabel> selectItemsElabelList(Long fId, Long itemId) {
+        return elabelMapper.selectItemsElabelList(fId,itemId);
+    }
+
+    @Override
+    public TWarehousebillsitemsElabel selectByfId(Long labelId) {
+        return elabelMapper.selectById(labelId);
+    }
 }

+ 6 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsElabelMapper.xml

@@ -157,4 +157,10 @@
                  left join t_whgenleg t3 on t3.f_originalbillno = t2.f_billno
         where t3.f_id = #{stockId}
     </select>
+    <select id="selectItemsElabelList" resultMap="ElabelResult">
+        <include refid="selectElabel"/>
+        <where>
+            f_g_pid = #{fId} and f_pid = #{itemId}
+        </where>
+    </select>
 </mapper>