Browse Source

问题修改

xiaochen 2 years ago
parent
commit
dae399ba64

+ 25 - 0
src/main/java/com/tld/controller/QueryListController.java

@@ -294,5 +294,30 @@ public class QueryListController {
         return queryListService.getDisplayContent(receiveGoods);
     }
 
+    /**
+    * @Description: 首页原材料展示信息
+    * @Param: ReceiveGoods
+    * @return:  Map<String, Object>
+    * @Author: XiaoChen
+    * @Date: 2023/5/5
+    */
+    @GetMapping("getRawMaterial")
+    public Map<String, Object> getRawMaterial(ReceiveGoods receiveGoods){
+        return queryListService.getRawMaterial(receiveGoods);
+    }
+
+
+    /**
+    * @Description: 首页展示产成品信息
+    * @Param:
+    * @return:
+    * @Author: XiaoChen
+    * @Date: 2023/5/5
+    */
+    @GetMapping("getFinishedGoods")
+    public Map<String, Object> getFinishedGoods(ReceiveGoods receiveGoods){
+        return queryListService.getFinishedGoods(receiveGoods);
+    }
+
 }
 

+ 14 - 0
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -71,4 +71,18 @@ public interface QueryListMapper {
     Integer getUnarrivedQuantity(ReceiveGoods receiveGoods);
 
     Integer getTimeoutQuantity(ReceiveGoods receiveGoods);
+
+    Integer getPurchaseSum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getSomeoneSum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getAskGoodsSum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getInviteSum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getEnquirySum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getNoticeSum(@Param("format") String format, @Param("nameType") String nameType);
+
+    Integer getDeliverySum(@Param("format") String format, @Param("nameType") String nameType);
 }

+ 4 - 0
src/main/java/com/tld/service/QueryListService.java

@@ -63,4 +63,8 @@ public interface QueryListService {
     Map<String, Object> reserveWarningNotToken(Inventory inventory);
 
     Map<String, Object> getDisplayContent(ReceiveGoods receiveGoods);
+
+    Map<String, Object> getRawMaterial(ReceiveGoods receiveGoods);
+
+    Map<String, Object> getFinishedGoods(ReceiveGoods receiveGoods);
 }

+ 75 - 6
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -374,10 +374,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")){
                             for(JSONObject jsonObject2 : retunList){
                                 if(jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))){
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("ReqOutStocks", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("出库回传");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("出库回传");
                                     errorMapper.addError(error);
                                     List<JSONObject> list = (List<JSONObject>) jsonObject2.get("BillItems");
                                     for(JSONObject jsonObject3 : list){
@@ -807,10 +818,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")){
                             for(JSONObject jsonObject2 : retunList){
                                 if(jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))){
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("BILLs", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("销售出库");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("销售出库");
                                     errorMapper.addError(error);
                                     List<JSONObject> list = (List<JSONObject>) jsonObject2.get("BillItems");
                                     for(JSONObject jsonObject3 : list){
@@ -957,10 +979,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")) {
                             for (JSONObject jsonObject2 : retunList) {
                                 if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("FromWareHouse").toString().equals(map.get("FromWareHouse"))) {
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("BILLs", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("移库");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("移库");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -1072,10 +1105,13 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                                     //如果失败存入报错信息跟数据
                                     List<JSONObject> retunList2 = new LinkedList<>();
                                     retunList2.add(jsonObject2);
+
                                     JSONObject ReqOutStocks1 = new JSONObject();
                                     ReqOutStocks1.put("BILLs", retunList2);
+
                                     JSONObject ReqOutStocks2 = new JSONObject();
                                     ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
                                     error.setDataVal(ReqOutStocks2.toJSONString()).setType("生产收货");
@@ -1185,10 +1221,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")) {
                             for (JSONObject jsonObject2 : retunList) {
                                 if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("BILLs", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("其它入库");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("其它入库");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -1290,10 +1337,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")) {
                             for (JSONObject jsonObject2 : retunList) {
                                 if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("ReqOutStocks", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("其它出库");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("其它出库");
                                     errorMapper.addError(error);
                                 }
                             }
@@ -1397,10 +1455,21 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         if (map.get("State").toString().equals("0")) {
                             for (JSONObject jsonObject2 : retunList) {
                                 if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
+
+                                    //如果失败存入报错信息跟数据
+                                    List<JSONObject> retunList2 = new LinkedList<>();
+                                    retunList2.add(jsonObject2);
+
+                                    JSONObject ReqOutStocks1 = new JSONObject();
+                                    ReqOutStocks1.put("ReqOutStocks", retunList2);
+
+                                    JSONObject ReqOutStocks2 = new JSONObject();
+                                    ReqOutStocks2.put("strJson",ReqOutStocks1);
+
                                     //如果失败存入报错信息跟数据
                                     error.setErrorInfo(map.get("FailReason").toString());
                                     error.setUrl(url);
-                                    error.setDataVal(jsonObject2.toString()).setType("其它出库");
+                                    error.setDataVal(ReqOutStocks2.toString()).setType("其它出库");
                                     errorMapper.addError(error);
                                 }
                             }

+ 103 - 0
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -14,6 +14,7 @@ import com.tld.model.Error;
 import com.tld.service.QueryListService;
 import com.tld.util.HttpClientUtil;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -761,9 +762,111 @@ public class QueryListServiceImpl implements QueryListService {
             Error error = new Error();
             error.setTransmissionType("1");
             Integer  ErrorListAmount = errorMapper.getErrorListAmount(error);
+            //查询当天采购单的未收货总数量和已收货数量
+            Integer quantityArrived = queryListMapper.getQuantityArrived(receiveGoods);
+            Integer unarrivedQuantity = queryListMapper.getUnarrivedQuantity(receiveGoods);
+
             map1.put("deadStockAmount",deadStockAmount);//呆滞品总数量
             map1.put("earlyWarningAmount",earlyWarningAmount);//库存预警总数量
             map1.put("ErrorListAmount",ErrorListAmount);//库存预警总数量
+            map1.put("quantityArrived",quantityArrived);//收货数量
+            map1.put("unarrivedQuantity",unarrivedQuantity);//未收货数量
+
+            map.put("data", map1);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    /**
+     * @Description: 首页原材料膳食信息
+     * @Param: ReceiveGoods
+     * @return:  Map<String, Object>
+     * @Author: XiaoChen
+     * @Date: 2023/5/5
+     */
+    @Override
+    public Map<String, Object> getRawMaterial(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            ArrayList<Map<String, Object>> map1 = new ArrayList<>();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            for (int i = 0; i < 7; i++) {
+                Date date = DateUtils.addDays(new Date(), -i);
+                //日期[2023-05-05, 2023-05-04, 2023-05-03, 2023-05-02, 2023-05-01, 2023-04-30, 2023-04-29]
+                String format = simpleDateFormat.format(date);
+                Map<String, Object> map2 = new HashMap<>();
+                String nameType = "原材料" ;
+                //入库数量
+                Integer amount = 0 ;
+                Integer sum = queryListMapper.getPurchaseSum(format,nameType);//采购入库数量
+                Integer sum1 = queryListMapper.getSomeoneSum(format,nameType);//其他入库数量
+                amount = sum + sum1 ;
+                //出库数量
+                Integer count = 0 ;
+                Integer sum2 = queryListMapper.getAskGoodsSum(format,nameType);//生成领料出库数量
+                Integer sum3 = queryListMapper.getInviteSum(format,nameType);//非生产领料出库数量
+                Integer sum4 = queryListMapper.getEnquirySum(format,nameType);//其他出库数量
+                count =  sum2 + sum3 + sum4  ;
+
+                map2.put("dateTime",format.substring(5));//日期
+                map2.put("amount",amount);//入库数量
+                map2.put("count",count);//出库数量
+
+                map1.add(map2);
+            }
+
+            map.put("data", map1);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    /**
+     * @Description: 首页展示产成品信息
+     * @Param:
+     * @return:
+     * @Author: XiaoChen
+     * @Date: 2023/5/5
+     */
+    @Override
+    public Map<String, Object> getFinishedGoods(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            ArrayList<Map<String, Object>> map1 = new ArrayList<>();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            for (int i = 0; i < 7; i++) {
+                Date date = DateUtils.addDays(new Date(), -i);
+                //日期[2023-05-05, 2023-05-04, 2023-05-03, 2023-05-02, 2023-05-01, 2023-04-30, 2023-04-29]
+                String format = simpleDateFormat.format(date);
+                Map<String, Object> map2 = new HashMap<>();
+                String nameType = "产成品" ;
+                //入库数量
+                Integer amount = 0 ;
+                Integer sum = queryListMapper.getNoticeSum(format,nameType);//报工单入库数量
+                Integer sum1 = queryListMapper.getSomeoneSum(format,nameType);//其他入库数量
+                amount = sum + sum1 ;
+                //出库数量
+                Integer count = 0 ;
+                Integer sum2 = queryListMapper.getDeliverySum(format,nameType);//销售单出库数量
+                Integer sum3 = queryListMapper.getEnquirySum(format,nameType);//其他出库数量
+                count =  sum2 + sum3 ;
+
+                map2.put("dateTime",format.substring(5));//日期
+                map2.put("amount",amount);//入库数量
+                map2.put("count",count);//出库数量
+
+                map1.add(map2);
+            }
+
             map.put("data", map1);
             map.put("msg", "200");
         } catch (Exception e){

+ 56 - 0
src/main/resources/mapper/QueryListMappeer.xml

@@ -1170,4 +1170,60 @@
         and arrival_time <![CDATA[<]]> NOW()
         and type = '0'
     </select>
+    <!--查询采购单入库数量-->
+    <select id="getPurchaseSum" resultType="java.lang.Integer">
+        select IFNULL(sum(warehousing_num),0) as amount  from tld_receive_goods a
+        left join tld_receive_goods_f b on a.order_code = b.order_code
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.arrival_time, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--查询其他入库数量-->
+    <select id="getSomeoneSum" resultType="java.lang.Integer">
+        select IFNULL(sum(warehousing_num),0) as amount  from tld_notices a
+        left join tld_notices_f b on a.notice_id = b.notice_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.notice_time, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--生成领料出库数量-->
+    <select id="getAskGoodsSum" resultType="java.lang.Integer">
+        select IFNULL(sum(out_num),0) as amount  from tld_ask_goods a
+        left join tld_ask_goods_f b on a.ask_goods_id = b.ask_goods_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.sqrq, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--非生产领料出库数量-->
+    <select id="getInviteSum" resultType="java.lang.Integer">
+        select IFNULL(sum(out_num),0) as amount  from tld_invite a
+        left join tld_invite_f b on a.ask_goods_id = b.ask_goods_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.sqrq, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--其他出库数量-->
+    <select id="getEnquirySum" resultType="java.lang.Integer">
+        select IFNULL(sum(out_num),0) as amount  from tld_enquiry a
+        left join tld_enquiry_f b on a.ask_goods_id = b.ask_goods_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.sqrq, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--报工单入库数量-->
+    <select id="getNoticeSum" resultType="java.lang.Integer">
+        select IFNULL(sum(warehousing_num),0) as amount  from tld_notice a
+        left join tld_notice_f b on a.notice_id = b.notice_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type = #{nameType}
+        and DATE_FORMAT( b.notice_time, '%Y-%m-%d' ) = #{format}
+    </select>
+    <!--销售单出库数量-->
+    <select id="getDeliverySum" resultType="java.lang.Integer">
+        select  IFNULL(sum(out_num),0) as amount from tld_delivery a
+        left join tld_delivery_f b on a.delivery_id = b.delivery_id
+        left join tld_material c on a.material_id = c.tld_id
+        where  c.part_type =  #{nameType}
+        and DATE_FORMAT( b.bills_time, '%Y-%m-%d' ) = #{format}
+    </select>
 </mapper>