zhs před 2 roky
rodič
revize
5ee45fbd17

+ 0 - 2
src/main/java/com/tld/controller/AskGoodsController.java

@@ -156,6 +156,4 @@ public class AskGoodsController {
     public void getRemovalHalfExcel(AskGoods askGoods, HttpServletResponse response){
         askGoodsService.getRemovalHalfExcel(askGoods, response);
     }
-
-
 }

+ 31 - 0
src/main/java/com/tld/controller/WarehouseTransferController.java

@@ -0,0 +1,31 @@
+package com.tld.controller;
+
+import com.tld.model.WarehouseTransfer;
+import com.tld.service.WarehouseTransferService;
+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.RestController;
+
+import java.util.Map;
+
+/**
+ * 移库
+ */
+@RestController
+@RequestMapping("warehouseTransfer")
+public class WarehouseTransferController {
+
+    @Autowired
+    private WarehouseTransferService warehouseTransferService;
+
+    /**
+     * 查询移库单
+     * @param warehouseTransfer 参数
+     * @return 返回结果
+     */
+    @GetMapping("getWarehouseTransfer")
+    public Map<String, Object> getWarehouseTransfer(WarehouseTransfer warehouseTransfer){
+        return warehouseTransferService.getWarehouseTransfer(warehouseTransfer);
+    }
+}

+ 18 - 0
src/main/java/com/tld/controller/WarehousingController.java

@@ -160,5 +160,23 @@ public class WarehousingController {
         return warehousingService.getProductWarehousingRecommend(uniqueCode, type, noticeId);
     }
 
+    /**
+     * 产成品入库流水
+     * @param notice 参数
+     * @return 返回结果
+     */
+    @GetMapping("getHalf")
+    public Map<String, Object> getHalf(Notice notice){
+        return warehousingService.getHalf(notice);
+    }
 
+    /**
+     * 产成品导出
+     * @param notice 参数
+     * @param response 返回结果
+     */
+    @GetMapping("getHalfExcel")
+    public void getHalfExcel(Notice notice, HttpServletResponse response){
+        warehousingService.getHalfExcel(notice, response);
+    }
 }

+ 2 - 0
src/main/java/com/tld/mapper/DictionaryMapper.java

@@ -20,4 +20,6 @@ public interface DictionaryMapper {
     void addTreasuryAccount(Dictionary dictionary);
 
     List<Dictionary> getDictionaryPage(Dictionary dictionary);
+
+    String getWarehouse(String storageLocationCode);
 }

+ 11 - 0
src/main/java/com/tld/mapper/WarehouseTransferMapper.java

@@ -0,0 +1,11 @@
+package com.tld.mapper;
+
+import com.tld.model.WarehouseTransfer;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface WarehouseTransferMapper {
+    List<WarehouseTransfer> getWarehouseTransfer(WarehouseTransfer warehouseTransfer);
+}

+ 5 - 1
src/main/java/com/tld/mapper/WarehousingMapper.java

@@ -53,7 +53,7 @@ public interface WarehousingMapper {
 
     Map<String, Object> getScanIsNot(@Param("wllbCode")String wllbCode, @Param("suppId")String suppId, @Param("unique")String unique, @Param("producDate")String producDate);
 
-    int getMateriaIsExist(String wllbCode);
+    MaterialClass getMateriaIsExist(String wllbCode);
 
     List<String> getInventoryProduc(@Param("wllbCode")String wllbCode, @Param("producDate")String producDate, @Param("storageLocationCode")String storageLocationCode);
 
@@ -92,4 +92,8 @@ public interface WarehousingMapper {
     void addHalf(WarehousingVirtual warehousingVirtual);
 
     List<WarehousingVirtual> getVirtualNotice(@Param("uniqueCode")String uniqueCode, @Param("type")String type, @Param("noticeId")String noticeId);
+
+    List<Notice> getHalf(Notice notice);
+
+    List<Map<String, Object>> getHalfExcel(Notice notice);
 }

+ 77 - 0
src/main/java/com/tld/model/WarehouseTransfer.java

@@ -0,0 +1,77 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 移库
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class WarehouseTransfer {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 移库通知单id
+     */
+    private String warehouseTransferId;
+    /**
+     * 移库通知单code
+     */
+    private String warehouseTransferCode;
+    /**
+     * 要货仓库id
+     */
+    private String askGoodsWarehouseId;
+    /**
+     * 单据日期
+     */
+    private String documentTime;
+    /**
+     * 移库类型
+     */
+    private String warehouseTransferType;
+    /**
+     * 分录号
+     */
+    private String entryNumber;
+    /**
+     * 供货仓库id
+     */
+    private String supplyWarehouseId;
+    /**
+     * 物料id
+     */
+    private String materialId;
+    /**
+     * wbs
+     */
+    private String wbs;
+    /**
+     * 计量单位
+     */
+    private String measurementId;
+    /**
+     * 数量
+     */
+    private String num;
+    /**
+     * 出库数量
+     */
+    private String outNum;
+    /**
+     * 是否移库
+     */
+    private String type;
+    /**
+     * 分数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+}

+ 9 - 0
src/main/java/com/tld/service/WarehouseTransferService.java

@@ -0,0 +1,9 @@
+package com.tld.service;
+
+import com.tld.model.WarehouseTransfer;
+
+import java.util.Map;
+
+public interface WarehouseTransferService {
+    Map<String, Object> getWarehouseTransfer(WarehouseTransfer warehouseTransfer);
+}

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

@@ -37,4 +37,8 @@ public interface WarehousingService {
     Map<String, Object> getProductWarehousing(Notice notice);
 
     Map<String, Object> getProductWarehousingRecommend(String uniqueCode, String type, String noticeId);
+
+    Map<String, Object> getHalf(Notice notice);
+
+    void getHalfExcel(Notice notice, HttpServletResponse response);
 }

+ 37 - 0
src/main/java/com/tld/service/impl/WarehouseTransferServiceImpl.java

@@ -0,0 +1,37 @@
+package com.tld.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.tld.mapper.WarehouseTransferMapper;
+import com.tld.mapper.WarehousingMapper;
+import com.tld.model.Notice;
+import com.tld.model.WarehouseTransfer;
+import com.tld.service.WarehouseTransferService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class WarehouseTransferServiceImpl implements WarehouseTransferService {
+
+    @Autowired
+    private WarehouseTransferMapper warehouseTransferMapper;
+
+    @Override
+    public Map<String, Object> getWarehouseTransfer(WarehouseTransfer warehouseTransfer) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<WarehouseTransfer> list = warehouseTransferMapper.getWarehouseTransfer(warehouseTransfer);
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+}

+ 60 - 5
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -50,12 +50,17 @@ public class WarehousingServiceImpl implements WarehousingService {
         Map<String, Object> map = new HashMap<>();
         try{
             //判断物料是否录入
-            int count = warehousingMapper.getMateriaIsExist(wllbCode);
-            if(count == 0){
+            MaterialClass materialClass = warehousingMapper.getMateriaIsExist(wllbCode);
+            if(materialClass == null){
                 map.put("msg", "500");
                 map.put("errMsg", "物料信息未录入,请联系管理员");
                 return map;
             }
+            if(materialClass.getPartType().equals("半成品") || materialClass.getPartType().equals("产成品")){
+                map.put("msg", "500");
+                map.put("errMsg", "此物料是" + materialClass.getPartType());
+                return map;
+            }
             Map<String, Object> mapVal = warehousingMapper.getScanIsNot(wllbCode, suppId, unique, producDate);
             if(Integer.parseInt(mapVal.get("inventoryCount").toString()) != 0 || Integer.parseInt(mapVal.get("virtualCount").toString()) != 0){
                 map.put("msg", "500");
@@ -74,11 +79,16 @@ public class WarehousingServiceImpl implements WarehousingService {
             if(listMaterialClass.size() == 0){
                 listMaterialClass = warehousingMapper.getMaterialClassType(wllbCode);
             }
+            if(listMaterialClass.size() == 0){
+                map.put("msg", "500");
+                map.put("errMsg", "该物料未绑定库位");
+                return map;
+            }
             StringBuffer stringBuffer = new StringBuffer();
             Map<String, Object> listMap = new HashMap<>();
             for(int i = 0; i < listMaterialClass.size(); i++) {
                 Map<String, Object> map1 = warehousingMapper.getScanNum(listMaterialClass.get(i).getStorageLocationCode(), num);
-                if(Double.parseDouble(String.valueOf(map1.get("scanNum"))) < Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity")))){
+                if(Double.parseDouble(String.valueOf(map1.get("scanNum"))) <= Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity")))){
                     //查询库存是否同物料同批次存在
                     List<String> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
                     if(countProduc.size() == 0){
@@ -193,7 +203,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                                 .setMoveType(receiveGoods1.getMoveType())
                                 .setEntryNumber(receiveGoods1.getEntryNumber())
                                 .setWbs(receiveGoods1.getWbs())
-                                .setReceiveGoodsId(receiveGoods1.getId())
+                                .setId(receiveGoods1.getId())
                                 .setMaterialId(receiveGoods1.getMaterialId())
                                 .setStorageCode(codeGenerateRk())
                                 .setOrderNumber(receiveGoods1.getOrderNumber())
@@ -380,7 +390,9 @@ public class WarehousingServiceImpl implements WarehousingService {
                     .setEntryNumber(notice1.getEntryNumber())//gs分录号
                     .setMaterialId(notice1.getMaterialId())//物料id
                     .setId(notice1.getId())//分录单id
-                    .setWarehousingNum(notice.getWarehousingNum());//入库数量
+                    .setWarehousingNum(notice.getWarehousingNum())//入库数量
+                    .setStorageLocationCode("000000")//库位编号
+                    .setUserName(notice.getUserName());//用户名称
             warehousingMapper.addReturnWarehousing(returnWarehousing);
             map.put("data", storageCode);
             map.put("msg", "200");
@@ -650,6 +662,49 @@ public class WarehousingServiceImpl implements WarehousingService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> getHalf(Notice notice) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(notice.getPage(), notice.getLimit());
+            PageInfo<Notice> list = new PageInfo<>(warehousingMapper.getHalf(notice));
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public void getHalfExcel(Notice notice, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("物料名称", "生产批次", "数量", "用户名称", "库位编号", "入库时间", "连翻号", "序列号", "属性");
+            //查询数据
+            PageHelper.startPage(notice.getPage(), notice.getLimit());
+            PageInfo<Map<String, Object>> list = new PageInfo<>(warehousingMapper.getHalfExcel(notice));
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list.getList()){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "入库流水数据导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
     /**
      * 入库单生成
      * @return

+ 1 - 1
src/main/resources/mapper/AskGoodsMapper.xml

@@ -225,7 +225,7 @@
     </select>
     <!-- 新增返回gs数据父表信息 -->
     <insert id="addReturnGsRemovalF">
-        insert into tld_return_gs_removal(ask_goods_id,removal_code,source_type,move_type,scrq,delivery_type)
+        insert into tld_return_gs_removal(document_id,removal_code,source_type,move_type,scrq,delivery_type)
         values(#{documentId},#{removalCode},#{sourceType},#{moveType},now(),#{deliveryType})
     </insert>
     <!-- 查询当天出库数量 -->

+ 4 - 0
src/main/resources/mapper/DictionaryMapper.xml

@@ -54,4 +54,8 @@
         insert into tld_treasury_account(material_id,code,name,num)
         values(#{materialId},#{code},#{name},#{num})
     </insert>
+    <!-- 查询仓库id -->
+    <select id="getWarehouse" resultType="String">
+        select warehouse_where from tld_storage_location where storage_location_code = #{storageLocationCode}
+    </select>
 </mapper>

+ 26 - 0
src/main/resources/mapper/WarehouseTransferMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tld.mapper.WarehouseTransferMapper">
+    <!-- 查询移库单 -->
+    <select id="getWarehouseTransfer" resultType="com.tld.model.WarehouseTransfer">
+        select
+            a.id,
+            a.warehouse_transfer_id,
+            a.entry_number,
+            a.supply_warehouse_id,
+            a.material_id,
+            a.wbs,
+            a.measurement_id,
+            a.num,
+            a.out_num,
+            a.type,
+            b.warehouse_transfer_code,
+            b.ask_goods_warehouse_id,
+            b.document_time,
+            b.warehouse_transfer_type
+        from tld_warehouse_transfer a
+        join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
+        where type = #{type}
+    </select>
+</mapper>

+ 80 - 7
src/main/resources/mapper/WarehousingMapper.xml

@@ -12,7 +12,7 @@
             a.storage_location_code,
             a.wllb_code
         from tld_material_class a
-        right join tld_material b on a.wllb_code = b.tld_id
+        join tld_material b on a.wllb_code = b.tld_id
         where b.code = #{wllbCode}
     </select>
     <!-- 根据物料分类查询库位 -->
@@ -156,7 +156,7 @@
         insert into tld_inventory(storage_location_code,wllb_class,material_id,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch)
         values
         <foreach collection="list" index="index" item="item" separator=",">
-            (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate}, now(),#{item.producDate}, '0')
+            (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate}, now(),#{item.producDate})
         </foreach>
     </insert>
     <!-- 删除临时表数据 -->
@@ -170,7 +170,7 @@
     <!-- 存入为gs穿的信息 -->
     <insert id="addReturnWarehousing">
         insert into tld_return_gs_warehousing(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number,user_name,storage_location_code)
-        values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber},#{userName},#{storageLocationCode});
+        values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{id},now(),#{orderNumber},#{userName},#{storageLocationCode});
     </insert>
     <!-- 入库回传 -->
     <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
@@ -272,8 +272,20 @@
         from dual
     </select>
     <!-- 查询物料是否存在 -->
-    <select id="getMateriaIsExist" resultType="int">
-        select count(0) from tld_material where code = #{wllbCode}
+    <select id="getMateriaIsExist" resultType="com.tld.model.MaterialClass">
+        select
+            id,
+            code,
+            name,
+            tld_id,
+            specification_and_model,
+            unit_of_measurement,
+            size,
+            wllb_class,
+            is_not_disable,
+            is_recommend,
+            part_type
+        from tld_material where code = #{wllbCode}
     </select>
     <!-- 查询库存是否同物料同批次存在 -->
     <select id="getInventoryProduc" resultType="int">
@@ -299,7 +311,8 @@
             a.warehousing_num,
             b.company_number,
             c.name as materialName,
-            c.wllb_class as wllbClass
+            c.wllb_class as wllbClass,
+            c.code as wllbCode
         from tld_notice a
         join tld_notice_f b on a.notice_id = b.notice_id
         join tld_material c on a.material_id = c.tld_id
@@ -512,7 +525,7 @@
         value(#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{scrq},#{serial},#{seq},#{attribute})
     </insert>
     <!-- 查询虚拟表数据进行入库 -->
-    <select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
+    <select id="getVirtualNotice" resultType="com.tld.model.WarehousingVirtual">
         select
             a.id,
             a.unique_code,
@@ -533,4 +546,64 @@
         left join tld_user b on a.user_id = b.id
         where a.unique_code = #{uniqueCode} and a.type = #{type} and a.notice_id = #{noticeId}
     </select>
+    <!-- 产成品入库流水 -->
+    <select id="getHalf" resultType="com.tld.model.Notice">
+        select
+            a.id,
+            a.wllb_code,
+            a.produc_date,
+            a.produc_batch,
+            a.capacity,
+            a.user_id,
+            a.storage_location_code,
+            a.scrq,
+            a.serial,
+            a.seq,
+            a.attribute,
+            b.name as materialName,
+            c.user_name as userName
+        from tld_half a
+        left join tld_material b on a.wllb_code = b.code
+        left join tld_user c on a.user_id = c.id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="wllbCode != null and wllbCode != ''">
+                and a.wllb_code = #{wllbCode}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.scrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.scrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by a.scrq desc
+    </select>
+    <!-- 产成品导出 -->
+    <select id="getHalfExcel" resultType="java.util.LinkedHashMap">
+        select
+            b.name as materialName,
+            a.produc_batch,
+            a.capacity,
+            c.user_name as userName
+            a.storage_location_code,
+            a.scrq,
+            a.serial,
+            a.seq,
+            a.attribute
+        from tld_half a
+        left join tld_material b on a.wllb_code = b.code
+        left join tld_user c on a.user_id = c.id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="wllbCode != null and wllbCode != ''">
+                and a.wllb_code = #{wllbCode}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.scrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.scrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by a.scrq desc
+    </select>
 </mapper>