Browse Source

仓库业务->修改app查询库存总帐接口

caifc 3 years ago
parent
commit
2fb7d37e0b

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TEnclosureController.java

@@ -59,6 +59,14 @@ public class TEnclosureController extends BaseController {
     }
 
     /**
+     * 根据上级id查询附件
+     */
+    @GetMapping(value = "infoByPid")
+    public AjaxResult infoByPid(@RequestParam("pId") Long pId) {
+        return tEnclosureService.selectInfoByPid(pId);
+    }
+
+    /**
      * 新增附件
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:enclosure:add')")

+ 35 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/app/TWarehousebillsAppController.java

@@ -0,0 +1,35 @@
+package com.ruoyi.web.controller.warehouse.warehouseBusiness.app;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 仓库app控制层
+ *
+ * @author ruoyi
+ * @date 2021-10-27
+ */
+@RestController
+@RequestMapping("/warehouse/app")
+public class TWarehousebillsAppController extends BaseController {
+    @Autowired
+    private ITWarehouseBillsService itWarehouseBillsService;
+
+    /**
+     * 查询库存总帐明细
+     *
+     * @param id 查询条件
+     * @return 库存总帐明细
+     */
+    @GetMapping("/whgenlegDetail")
+    public AjaxResult whgenlegDetail(@RequestParam("id") Long id) {
+        return itWarehouseBillsService.selectWhgenlegDetail(id);
+    }
+
+}

+ 137 - 129
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -3,9 +3,9 @@ package com.ruoyi.reportManagement.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.basicData.domain.TCustomerContact;
-import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TCustomerContactMapper;
 import com.ruoyi.basicData.mapper.TWarehouseMapper;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -18,7 +18,6 @@ import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
-import com.ruoyi.warehouseBusiness.excel.ListMapToBeanUtils;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -42,7 +41,7 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     private TWarehouseBillsMapper tWarehouseBillsMapper;
 
     @Autowired
-    private TWarehouseMapper  tWarehouseMapper;
+    private TWarehouseMapper tWarehouseMapper;
     @Autowired
     private TCustomerContactMapper customerContactMapper;
 
@@ -80,16 +79,16 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * 出库、调拨、货转查询库存总账列表
      *
      * @param tWhgenleg 库存总账
-     *      * @return 库存总账集合
+     *                  * @return 库存总账集合
      */
     @Override
     public List<Map<String, Object>> selectInventoryList(TWhgenleg tWhgenleg) {
-        if(StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())){
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息
-            TWarehouse tWarehouse =  tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
-            if(tWarehouse.getfLocation()==1){
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
                 tWhgenleg.setfLocation(1L);
-            }else {
+            } else {
                 tWhgenleg.setfLocation(0L);
             }
         }
@@ -104,12 +103,12 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      */
     @Override
     public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg) {
-        if(StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())){
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息
-            TWarehouse tWarehouse =  tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
-            if(tWarehouse.getfLocation()==1){
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
                 tWhgenleg.setfLocation(1L);
-            }else {
+            } else {
                 tWhgenleg.setfLocation(0L);
             }
         }
@@ -118,12 +117,12 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
 
     @Override
     public List<Map<String, Object>> selectWhgenlegList(TWhgenleg tWhgenleg) {
-        if(StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())){
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息
-            TWarehouse tWarehouse =  tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
-            if(tWarehouse.getfLocation()==1){
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
                 tWhgenleg.setfLocation(1L);
-            }else {
+            } else {
                 tWhgenleg.setfLocation(0L);
             }
         }
@@ -182,61 +181,61 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         Map<String, Object> map = new HashMap<>();
         // 查询仓库
         List<Map<String, Object>> whouseList;
-        if(null!= fId &&  fId!=0){
-            whouseList= tWhgenlegMapper.selectWareHouseListWhouse(fId);
-        }else {
-            whouseList= tWhgenlegMapper.selectWareHouseList();
+        if (null != fId && fId != 0) {
+            whouseList = tWhgenlegMapper.selectWareHouseListWhouse(fId);
+        } else {
+            whouseList = tWhgenlegMapper.selectWareHouseList();
         }
-        if(null!=whouseList && whouseList.size()>0){
+        if (null != whouseList && whouseList.size() > 0) {
             String fid = null; //获取 第一个 仓库ID
-            for(Map<String, Object> m : whouseList){
+            for (Map<String, Object> m : whouseList) {
                 String fGrossweightblc = null;
-                for (String k : m.keySet()){
-                    if(k.equals("fWarehouseid")){
-                        fid= m.get(k).toString();
+                for (String k : m.keySet()) {
+                    if (k.equals("fWarehouseid")) {
+                        fid = m.get(k).toString();
                     }
-                    if(k.equals("fGrossweightD")){
-                        fGrossweightblc=  m.get(k).toString();
+                    if (k.equals("fGrossweightD")) {
+                        fGrossweightblc = m.get(k).toString();
                     }
                 }
-                m.put("fGrossweightD",calculation2(fGrossweightblc,"1000"));
+                m.put("fGrossweightD", calculation2(fGrossweightblc, "1000"));
                 break;
             }
             //通过ID 查询仓库下 所有的 商品
-            List<Map<String, Object>> goodslistWhouse=tWhgenlegMapper.selectGoodsListWhouse(Long.parseLong(fid));
-            for (Map<String, Object> m : goodslistWhouse){
-                String  fTotalgross = null;
+            List<Map<String, Object>> goodslistWhouse = tWhgenlegMapper.selectGoodsListWhouse(Long.parseLong(fid));
+            for (Map<String, Object> m : goodslistWhouse) {
+                String fTotalgross = null;
                 String fGrossweightblc = null;
-                for (String k : m.keySet()){
+                for (String k : m.keySet()) {
                     // 获取毛重库容
-                    if(k.equals("fTotalgross")){
-                        fTotalgross= m.get(k).toString();
+                    if (k.equals("fTotalgross")) {
+                        fTotalgross = m.get(k).toString();
                     }
-                    if(k.equals("fGrossweightD")){
-                        fGrossweightblc=  m.get(k).toString();
+                    if (k.equals("fGrossweightD")) {
+                        fGrossweightblc = m.get(k).toString();
                     }
                 }
-                m.put("balance",calculation1(fTotalgross,fGrossweightblc));
-                m.put("fGrossweightD",calculation2(fGrossweightblc,"1000"));
+                m.put("balance", calculation1(fTotalgross, fGrossweightblc));
+                m.put("fGrossweightD", calculation2(fGrossweightblc, "1000"));
             }
             map.put("goodslistWhouse", goodslistWhouse);
             // 查询仓库下 所有的 客户
-            List<Map<String, Object>> corpsListWhouse=tWhgenlegMapper.selectCorpsListWhouse(Long.parseLong(fid));
+            List<Map<String, Object>> corpsListWhouse = tWhgenlegMapper.selectCorpsListWhouse(Long.parseLong(fid));
             // 计算库容 总剩余
-            for (Map<String, Object> m : corpsListWhouse){
-                String  fTotalgross = null;
+            for (Map<String, Object> m : corpsListWhouse) {
+                String fTotalgross = null;
                 String fGrossweightblc = null;
-                for (String k : m.keySet()){
+                for (String k : m.keySet()) {
                     // 获取毛重库容
-                    if(k.equals("fTotalgross")){
-                        fTotalgross= m.get(k).toString();
+                    if (k.equals("fTotalgross")) {
+                        fTotalgross = m.get(k).toString();
                     }
-                    if(k.equals("fGrossweightD")){
-                        fGrossweightblc=  m.get(k).toString();
+                    if (k.equals("fGrossweightD")) {
+                        fGrossweightblc = m.get(k).toString();
                     }
                 }
-                m.put("balance",calculation1(fTotalgross,fGrossweightblc));
-                m.put("fGrossweightD",calculation2(fGrossweightblc,"1000"));
+                m.put("balance", calculation1(fTotalgross, fGrossweightblc));
+                m.put("fGrossweightD", calculation2(fGrossweightblc, "1000"));
             }
             map.put("corpsListWhouse", corpsListWhouse);
         } else {
@@ -260,24 +259,24 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     public List<Map<String, Object>> selectWareHouseList() {
         List<Map<String, Object>> list = new ArrayList<>();
         list = tWhgenlegMapper.selectWareHouseList();
-        if(list!=null && list.size()>0){
-            for (Map<String, Object> m : list){
-                String  fTotalgross = null;
+        if (list != null && list.size() > 0) {
+            for (Map<String, Object> m : list) {
+                String fTotalgross = null;
                 String fGrossweightblc = null;
-                for (String k : m.keySet()){
+                for (String k : m.keySet()) {
                     // 获取毛重库容
-                    if(k.equals("fTotalgross")){
-                        fTotalgross= m.get(k).toString();
+                    if (k.equals("fTotalgross")) {
+                        fTotalgross = m.get(k).toString();
                     }
-                    if(k.equals("fGrossweightD")){
-                        fGrossweightblc=  m.get(k).toString();
+                    if (k.equals("fGrossweightD")) {
+                        fGrossweightblc = m.get(k).toString();
                     }
                 }
-                m.put("percentage",calculation(fGrossweightblc,fTotalgross));
-                m.put("fGrossweightD",calculation2(fGrossweightblc,"1000"));
+                m.put("percentage", calculation(fGrossweightblc, fTotalgross));
+                m.put("fGrossweightD", calculation2(fGrossweightblc, "1000"));
             }
         } else {
-            List<TWarehouse> tWarehouses= tWarehouseMapper.selectTWarehouseList(new TWarehouse());
+            List<TWarehouse> tWarehouses = tWarehouseMapper.selectTWarehouseList(new TWarehouse());
             for (TWarehouse tWarehouse : tWarehouses) {
                 Map<String, Object> maps = new HashMap<>();
                 maps.put("fName", tWarehouse.getfName());
@@ -294,7 +293,7 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     @Override
     public List<Map<String, Object>> selectWareHouseLists() {
         List<Map<String, Object>> list = new ArrayList<>();
-        List<TWarehouse> tWarehouses= tWarehouseMapper.selectTWarehouseLists(new TWarehouse());
+        List<TWarehouse> tWarehouses = tWarehouseMapper.selectTWarehouseLists(new TWarehouse());
         for (TWarehouse tWarehouse : tWarehouses) {
             Map<String, Object> maps = new HashMap<>();
             maps.put("fName", tWarehouse.getfName());
@@ -311,37 +310,37 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     public Map<String, Object> selectCorpsList(Long fId) {
         Map<String, Object> map = new HashMap<>();
         // 查询所有 客户
-        List<Map<String, Object>> corpsList=tWhgenlegMapper.selectCorpsList();
+        List<Map<String, Object>> corpsList = tWhgenlegMapper.selectCorpsList();
         map.put("corpsList", corpsList);
-        if(corpsList!=null){
+        if (corpsList != null) {
             Long fid = null;
-            for(Map<String, Object> m : corpsList){
-                for (String k : m.keySet()){
-                    if(k.equals("fCorpid")){
-                        fid= (Long) m.get(k);
+            for (Map<String, Object> m : corpsList) {
+                for (String k : m.keySet()) {
+                    if (k.equals("fCorpid")) {
+                        fid = (Long) m.get(k);
                     }
                     break;
                 }
             }
             List<Map<String, Object>> corpsListWhouse;
-            if(null!= fId ){
-                corpsListWhouse=tWhgenlegMapper.selectCorpsListWhouse(fId);
-            }else{
-                corpsListWhouse=tWhgenlegMapper.selectCorpsListWhouse(fid);
+            if (null != fId) {
+                corpsListWhouse = tWhgenlegMapper.selectCorpsListWhouse(fId);
+            } else {
+                corpsListWhouse = tWhgenlegMapper.selectCorpsListWhouse(fid);
             }
-            for (Map<String, Object> m : corpsListWhouse){
-                String  fTotalgross = null;
+            for (Map<String, Object> m : corpsListWhouse) {
+                String fTotalgross = null;
                 String fGrossweightblc = null;
-                for (String k : m.keySet()){
+                for (String k : m.keySet()) {
                     // 获取毛重库容
-                    if(k.equals("fTotalgross")){
-                        fTotalgross= m.get(k).toString();
+                    if (k.equals("fTotalgross")) {
+                        fTotalgross = m.get(k).toString();
                     }
-                    if(k.equals("fGrossweightD")){
-                        fGrossweightblc=  m.get(k).toString();
+                    if (k.equals("fGrossweightD")) {
+                        fGrossweightblc = m.get(k).toString();
                     }
                 }
-                m.put("percentage",calculation(fGrossweightblc,fTotalgross));
+                m.put("percentage", calculation(fGrossweightblc, fTotalgross));
             }
             map.put("corpsListWhouse", corpsListWhouse);
         }
@@ -353,41 +352,41 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         // 当天往前推 一周
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd ");
         Calendar c = Calendar.getInstance();
-        c.add(Calendar.DATE, - 8);
+        c.add(Calendar.DATE, -8);
         String frontday = format.format(c.getTime());
         // 当前日期
-        String nowadays=DateUtils.getDate();
+        String nowadays = DateUtils.getDate();
         Map<String, Object> map = new HashMap<>();
         map.put("frontday", frontday);
         map.put("nowadays", nowadays);
 
-        List<Map<String, Object>>  list= tWhgenlegMapper.selectDateFQtyblcListList(map);
+        List<Map<String, Object>> list = tWhgenlegMapper.selectDateFQtyblcListList(map);
         // 对比 日期 为空入库赋值0
-        ArrayList<String> pastDaysList=dayList(8);
-        for(String day:pastDaysList){
-            if(!day.equals(nowadays)){
+        ArrayList<String> pastDaysList = dayList(8);
+        for (String day : pastDaysList) {
+            if (!day.equals(nowadays)) {
                 Map<String, Object> map1 = new HashMap<String, Object>();
-                map1.put("fOriginalbilldate",day);
-                map1.put("fQtyblc",0);
+                map1.put("fOriginalbilldate", day);
+                map1.put("fQtyblc", 0);
                 list.add(map1);
             }
         }
-        List<Map<String,Object>> countList = combineMap("fOriginalbilldate", list);
+        List<Map<String, Object>> countList = combineMap("fOriginalbilldate", list);
         return countList;
     }
 
     @Override
     public List<Whgenleg> whgenlegExport(TWhgenleg tWhgenleg) throws Exception {
-        if(StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())){
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息
-            TWarehouse tWarehouse =  tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
-            if(tWarehouse.getfLocation()==1){
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
                 tWhgenleg.setfLocation(1L);
-            }else {
+            } else {
                 tWhgenleg.setfLocation(0L);
             }
         }
-        List<Whgenleg> list =  tWhgenlegMapper.selectWhgenlegMessage(tWhgenleg);
+        List<Whgenleg> list = tWhgenlegMapper.selectWhgenlegMessage(tWhgenleg);
         //List<Whgenleg> list1 = ListMapToBeanUtils.castMapToBean(list,Whgenleg.class);
         return list;
     }
@@ -400,9 +399,10 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     /**
-     *  查询单票分析信息
+     * 查询单票分析信息
+     *
      * @param singleAnalysisExcel 查询条件
-     * @return  结果
+     * @return 结果
      */
     @Override
     public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel) {
@@ -410,7 +410,8 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     /**
-     *  查询单票分析费用信息
+     * 查询单票分析费用信息
+     *
      * @param singleAnalysisExcel
      * @return
      */
@@ -426,38 +427,40 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
 
     @Override
     public List<Map<String, Object>> appWhGenLegList(TWhgenleg tWhgenleg) {
-        List<Map<String,Object>> list = new ArrayList<>();
+        List<Map<String, Object>> list = new ArrayList<>();
         TCustomerContact customerContact = new TCustomerContact();
-        customerContact.setfTel(SecurityUtils.getLoginUser().getUser().getPhonenumber());
-        List<TCustomerContact> tCustomerContacts = customerContactMapper.selectTCustomerContactList(customerContact);
-        if (CollectionUtils.isNotEmpty(tCustomerContacts)){
-            tWhgenleg.setfCorpid(tCustomerContacts.get(0).getfPid());
-            if(StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())){
-                // 获取仓库信息
-                TWarehouse tWarehouse =  tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
-                if(tWarehouse.getfLocation()==1){
-                    tWhgenleg.setfLocation(1L);
-                }else {
-                    tWhgenleg.setfLocation(0L);
-                }
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            customerContact.setfTel(SecurityUtils.getLoginUser().getUser().getPhonenumber());
+            List<TCustomerContact> tCustomerContacts = customerContactMapper.selectTCustomerContactList(customerContact);
+            if (CollectionUtils.isNotEmpty(tCustomerContacts)) {
+                tWhgenleg.setfCorpid(tCustomerContacts.get(0).getfPid());
+            }
+        }
+        if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
+            // 获取仓库信息
+            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
+            if (tWarehouse.getfLocation() == 1) {
+                tWhgenleg.setfLocation(1L);
+            } else {
+                tWhgenleg.setfLocation(0L);
             }
-            list = tWhgenlegMapper.selectInventoryMapList(tWhgenleg);
         }
-        if (SecurityUtils.getUsername().equals("admin")){
+        list = tWhgenlegMapper.selectInventoryMapList(tWhgenleg);
+        if ("admin".equals(SecurityUtils.getUsername())) {
             list = tWhgenlegMapper.selectInventoryMapList(tWhgenleg);
         }
         return list;
     }
 
     /**
-     *
      * @param fOriginalbilldate 根据该字段进行合并
-     * @param dataList 原始数据
+     * @param dataList          原始数据
      * @return
      */
-    public static List<Map<String, Object>> combineMap(String fOriginalbilldate, List<Map<String, Object>> dataList){
+    public static List<Map<String, Object>> combineMap(String fOriginalbilldate, List<Map<String, Object>> dataList) {
         //用于存放最后的结果
-        List<Map<String, Object>> countList = new ArrayList<Map<String,Object>>();
+        List<Map<String, Object>> countList = new ArrayList<Map<String, Object>>();
         for (int i = 0; i < dataList.size(); i++) {
             String oldCombineField = String.valueOf(dataList.get(i).get(fOriginalbilldate));
 
@@ -482,16 +485,18 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
 
     /**
      * 获取过去 任意天内的日期数组
-     * @param intervals      intervals天内
-     * @return              日期数组
+     *
+     * @param intervals intervals天内
+     * @return 日期数组
      */
-    public static ArrayList<String> dayList(int intervals ) {
+    public static ArrayList<String> dayList(int intervals) {
         ArrayList<String> pastDaysList = new ArrayList<>();
-        for (int i = 0; i <intervals; i++) {
+        for (int i = 0; i < intervals; i++) {
             pastDaysList.add(getPastDate(i));
         }
         return pastDaysList;
     }
+
     /**
      * 获取过去第几天的日期
      *
@@ -508,44 +513,47 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     /**
-     *    返回百分比
+     * 返回百分比
+     *
      * @param fTotalgross
      * @param fGrossweightblc
      * @return
      */
-    public static String  calculation(String  fTotalgross, String fGrossweightblc){
+    public static String calculation(String fTotalgross, String fGrossweightblc) {
         BigDecimal num1 = new BigDecimal(fTotalgross);
         BigDecimal num2 = new BigDecimal(fGrossweightblc);
-        BigDecimal result = num1.divide(num2,2,BigDecimal.ROUND_HALF_UP);
-        int i = new Double(result.doubleValue()*100).intValue();
-        String str = i +  "%";
+        BigDecimal result = num1.divide(num2, 2, BigDecimal.ROUND_HALF_UP);
+        int i = new Double(result.doubleValue() * 100).intValue();
+        String str = i + "%";
         return str;
     }
 
     /**
-     *   结余数/1000
+     * 结余数/1000
+     *
      * @param fTotalgross
      * @param fGrossweightblc
      * @return
      */
-    public static String  calculation2(String  fTotalgross, String fGrossweightblc){
+    public static String calculation2(String fTotalgross, String fGrossweightblc) {
         BigDecimal num1 = new BigDecimal(fTotalgross);
         BigDecimal num2 = new BigDecimal(fGrossweightblc);
-        BigDecimal result = num1.divide(num2,2,BigDecimal.ROUND_HALF_UP);
+        BigDecimal result = num1.divide(num2, 2, BigDecimal.ROUND_HALF_UP);
         return result.toString();
     }
 
     /**
-     *   库容-结余毛重
+     * 库容-结余毛重
+     *
      * @param fTotalgross
      * @param fGrossweightblc
      * @return
      */
-    public static BigDecimal  calculation1(String  fTotalgross, String fGrossweightblc){
+    public static BigDecimal calculation1(String fTotalgross, String fGrossweightblc) {
         BigDecimal num1 = new BigDecimal(fTotalgross);
         BigDecimal num2 = new BigDecimal(fGrossweightblc);
         BigDecimal result = num1.subtract(num2);
-        return result.setScale(2,BigDecimal.ROUND_HALF_UP);
+        return result.setScale(2, BigDecimal.ROUND_HALF_UP);
     }
 
 

+ 5 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/vo/WarehouseBillsVO.java

@@ -3,7 +3,6 @@ package com.ruoyi.warehouseBusiness.domain.vo;
 import com.ruoyi.basicData.domain.GoodsVO;
 import com.ruoyi.basicData.domain.TCorps;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
-import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import lombok.Data;
 
@@ -18,6 +17,11 @@ public class WarehouseBillsVO extends TWarehouseBills {
     private static final long serialVersionUID = 1L;
 
     /**
+     * 类型名称
+     */
+    private String billTypeName;
+
+    /**
      * 客户集合
      */
     private List<TCorps> corpsList;

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -12,6 +12,7 @@ import com.ruoyi.shipping.excel.SingleVoyageByShipExcel;
 import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
+import com.ruoyi.warehouseBusiness.domain.vo.WarehouseBillsVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -270,4 +271,12 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      */
     int selectByMblnoOrCntrnoCount(@Param("dto") WarehousebillsDTO warehousebillsDTO);
 
+    /**
+     * 根据提单号查询
+     *
+     * @param id 库存总账id
+     * @return
+     */
+    List<WarehouseBillsVO> selectWhgenlegDetailById(Long id);
+
 }

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITEnclosureService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.warehouseBusiness.service;
 
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.warehouseBusiness.domain.TEnclosure;
 
 import java.util.List;
@@ -59,4 +60,12 @@ public interface ITEnclosureService {
      * @return 结果
      */
     public int deleteTEnclosureById(Long fId);
+
+    /**
+     * 根据上级id查询附件集合
+     *
+     * @param fPid 上级id
+     * @return
+     */
+    AjaxResult selectInfoByPid(Long fPid);
 }

+ 9 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -700,9 +700,17 @@ public interface ITWarehouseBillsService {
     AjaxResult quickOperation(WarehousebillsDTO warehousebillsDTO, LoginUser loginUser);
 
     /**
-     *  校验提单号是否在同一天出现第二次
+     * 校验提单号是否在同一天出现第二次
+     *
      * @param warehousebillsDTO 查询条件
      */
     void checkMblNoRepeat(WarehousebillsDTO warehousebillsDTO);
 
+    /**
+     * app查询库存总帐明细
+     *
+     * @param id 查询条件
+     * @return 库存总帐明细
+     */
+    AjaxResult selectWhgenlegDetail(Long id);
 }

+ 13 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TEnclosureServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.warehouseBusiness.service.impl;
 
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.warehouseBusiness.domain.TEnclosure;
 import com.ruoyi.warehouseBusiness.mapper.TEnclosureMapper;
@@ -88,4 +89,16 @@ public class TEnclosureServiceImpl implements ITEnclosureService {
     public int deleteTEnclosureById(Long fId) {
         return tEnclosureMapper.deleteTEnclosureById(fId);
     }
+
+    /**
+     * 根据上级id查询附件集合
+     *
+     * @param fPid 上级id
+     * @return
+     */
+    @Override
+    public AjaxResult selectInfoByPid(Long fPid) {
+        return AjaxResult.success(tEnclosureMapper.selectTEnclosureByPId(fPid));
+    }
+
 }

+ 30 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -7206,7 +7206,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     /**
-     * 快速出库
+     * 快速入库、出库
      *
      * @param warehousebillsDTO 出库信息
      * @param loginUser         登陆人
@@ -7223,9 +7223,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 生成编号
         String billNo = billnoSerialServiceImpl.getBillNo(warehousebillsDTO.getfBilltype(), warehousebillsDTO.getfBsdate());
         warehousebillsDTO.setfBillno(billNo);
+        // 如果是入库则需要赋值客户存货编号
+        if (WarehouseTypeEnum.SJRK.getType().equals(warehousebillsDTO.getType())) {
+            Date time = new Date();
+            String bscorpno = billnoSerialServiceImpl.getCorpNo(warehousebillsDTO.getfCorpid(), time);
+            warehousebillsDTO.setfBscorpno(bscorpno);
+        }
         warehousebillsDTO.setCreateTime(new Date());
         warehousebillsDTO.setCreateBy(loginUser.getUsername());
         warehousebillsDTO.setfBsdeptid(loginUser.getUser().getDeptId());
+        warehousebillsDTO.setfChargedate(warehousebillsDTO.getfBsdate());
         warehousebillsDTO.setfBillstatus(Long.parseLong(WarehouseTypeEnum.SAVE.getType()));
         warehousebillsDTO.setfItemstatus(Long.parseLong(WarehouseTypeEnum.DETAILED_STATUS_PROCESSED.getType()));
         tWarehouseBillsMapper.insertTWarehousebills(warehousebillsDTO);
@@ -7237,7 +7244,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         BigDecimal netweight = BigDecimal.ZERO;
         BigDecimal grossweight = BigDecimal.ZERO;
         for (TWarehousebillsitems li : itemList) {
-            qty +=li.getfQty();
+            qty += li.getfQty();
             volumn = volumn.add(li.getfVolumn());
             netweight = netweight.add(li.getfNetweight());
             grossweight = grossweight.add(li.getfGrossweight());
@@ -7250,6 +7257,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             li.setfBillstatus(40L);
             li.setfBillno(warehousebillsDTO.getfBillno());
             li.setfBilltype(warehousebillsDTO.getfBilltype());
+            li.setCreateTime(new Date());
+            li.setCreateBy(loginUser.getUsername());
             if (warehousebillsDTO.getfBilltype().equals(WarehouseTypeEnum.SJRK.getType())) {
                 quickStorage(warehousebillsDTO, li, loginUser, line);
             } else if (warehousebillsDTO.getfBilltype().equals(WarehouseTypeEnum.SJCK.getType())) {
@@ -7344,8 +7353,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 更新库存总账
         updateTWhgenlegData(item, tWhgenle.getfId(), warehousebillsDTO.getfBilltype());
         DateUtils.getDateDay(warehousebillsDTO.getfBsdate(), item.getfChargedate());
-        item.setCreateTime(new Date());
-        item.setCreateBy(loginUser.getUsername());
         tWarehousebillsitemsMapper.insertTWarehousebillsitems(item);
         // 添加状态log
         insertTWarehousebillsLog(item, 40L, loginUser);
@@ -7378,6 +7385,25 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     /**
+     * app查询库存总帐明细
+     *
+     * @param id 查询条件
+     * @return 库存总帐明细
+     */
+    @Override
+    public AjaxResult selectWhgenlegDetail(Long id) {
+        // 查询明细
+        List<WarehouseBillsVO> warehouseBillsVOList = tWarehouseBillsMapper.selectWhgenlegDetailById(id);
+
+        warehouseBillsVOList.forEach(vo -> {
+            WarehouseTypeEnum warehouseTypeEnum = WarehouseTypeEnum.fromType(vo.getfBilltype());
+            vo.setBillTypeName(warehouseTypeEnum.getName());
+        });
+
+        return AjaxResult.success(warehouseBillsVOList);
+    }
+
+    /**
      * 如果是入库
      *
      * @param infoVO

+ 33 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -120,6 +120,17 @@
         <result property="fDismountStatus"    column="f_dismount_status"    />
     </resultMap>
 
+    <resultMap type="WarehouseBillsVO" id="WarehousebillsVOResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fBillno"    column="f_billno"    />
+        <result property="fMblno"    column="f_mblno"    />
+        <result property="fBsdate"    column="f_bsdate"    />
+        <result property="fQty"    column="f_qty"    />
+        <result property="fGrossweight"    column="f_grossweight"    />
+        <result property="fNetweight"    column="f_netweight"    />
+        <result property="fBilltype"    column="f_billtype"    />
+    </resultMap>
+
     <sql id="selectTWarehousebillsVo">
         select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno,
         f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
@@ -2696,4 +2707,26 @@
         </where>
     </select>
 
+    <select id="selectWhgenlegDetailById" resultMap="WarehousebillsVOResult">
+        SELECT w.f_id, w.f_mblno, w.f_bsdate, SUM( item.f_qty ) f_qty, SUM( item.f_grossweight ) f_grossweight,
+            SUM( item.f_netweight ) f_netweight, w.f_billtype
+        FROM
+            t_whgenleg leg
+                LEFT JOIN t_warehousebills w ON w.f_corpid = leg.f_corpid
+                AND leg.f_trademodeid = w.f_trademodeid
+                LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
+                AND item.f_marks = leg.f_marks
+                AND item.f_business_type = leg.f_business_type
+                AND item.f_originalbilldate = leg.f_bsdate
+                AND item.f_warehouselocid = leg.f_warehouse_locationid
+                AND item.f_goodsid = leg.f_goodsid
+        WHERE
+            leg.f_id = #{id}
+            AND w.f_billtype IN ( 'SJRK', 'SJCK' )
+            AND item.f_billstatus = 40
+            AND IF ( w.f_billtype = 'SJCK', item.f_mblno = leg.f_mblno, leg.f_mblno = w.f_mblno )
+        GROUP BY
+            w.f_id
+    </select>
+
 </mapper>