Ver código fonte

问题修改

xiaochen 2 anos atrás
pai
commit
1ca03542c1

+ 10 - 0
src/main/java/com/tld/controller/InventoryController.java

@@ -92,4 +92,14 @@ public class InventoryController {
          inventoryService.export(makeInventory,response);
     }
 
+    /**
+     * 导出录入盘点信息
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("exportEntering")
+    public void exportEntering(MakeInventory makeInventory , HttpServletResponse response){
+        inventoryService.exportEntering(makeInventory,response);
+    }
+
 }

+ 1 - 0
src/main/java/com/tld/mapper/InventoryMapper.java

@@ -39,4 +39,5 @@ public interface InventoryMapper {
 
     List<Map<String, Object>> getInventoryLocalityGs(List<Map<String, Object>> list);
 
+    List<Map<String ,Object>> exportEntering(MakeInventory makeInventory);
 }

+ 4 - 0
src/main/java/com/tld/model/Scrap.java

@@ -20,6 +20,10 @@ public class Scrap implements Serializable {
      * 操作人
      */
     private String operationName;
+    /**
+     * 名称
+     */
+    private String name;
     /**
      * 报废原因
      */

+ 3 - 0
src/main/java/com/tld/service/InventoryService.java

@@ -21,4 +21,7 @@ public interface InventoryService {
     Map<String, Object> getInventoryDataList(MakeInventory makeInventory);
 
     Map<String, Object> getInventoryPlates(MakeInventory makeInventory);
+
+    void exportEntering(MakeInventory makeInventory, HttpServletResponse response);
+
 }

+ 1 - 2
src/main/java/com/tld/service/impl/ContainerServiceImpl.java

@@ -96,6 +96,7 @@ public class ContainerServiceImpl implements ContainerService {
             //剩余数量 总数量 - 报废数量
             int num = Integer.parseInt(list.get(0).getNum()) - Integer.parseInt(param.get("scrapNum").toString());
             container.setNum(String.valueOf(num));
+            container.setModifyUser(param.get("userId").toString());
             containerMapper.updateContainer(container);
             map.put("msg", "200");
         }catch (Exception e){
@@ -114,7 +115,6 @@ public class ContainerServiceImpl implements ContainerService {
             //表头数据
             List<Object> head = Arrays.asList("部门", "类别", "容器编号","容器名称","数量","创建时间");
             //查询数据
-            PageHelper.startPage(container.getPage(), container.getLimit());
             List<Map<String, Object>> list = containerMapper.export(container);
             sheetDataList.add(head);
             for(Map<String, Object> userMap : list){
@@ -157,7 +157,6 @@ public class ContainerServiceImpl implements ContainerService {
             //表头数据
             List<Object> head = Arrays.asList("操作人", "报废原因", "报废时间","报废数量","容器名称");
             //查询数据
-            PageHelper.startPage(scrap.getPage(), scrap.getLimit());
             List<Map<String, Object>> list = containerMapper.exportScrap(scrap);
             sheetDataList.add(head);
             for(Map<String, Object> userMap : list){

+ 27 - 1
src/main/java/com/tld/service/impl/InventoryServiceImpl.java

@@ -137,7 +137,6 @@ public class InventoryServiceImpl implements InventoryService {
     public Map<String, Object> getInventoryPlate(MakeInventory makeInventory) {
         Map<String, Object> map = new HashMap<>();
         try {
-
             map.put("msg", "200");
         }catch (Exception e){
             e.printStackTrace();
@@ -185,4 +184,31 @@ public class InventoryServiceImpl implements InventoryService {
         return map ;
     }
 
+    @Override
+    public void exportEntering(MakeInventory makeInventory, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head =
+                    Arrays.asList("物料编号", "物料名称","库位名称","系统库存","实际库存");
+            //查询数据
+            List<Map<String, Object>> list = new ArrayList<>(inventoryMapper.exportEntering(makeInventory));
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                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();
+        }
+    }
+
 }

+ 11 - 1
src/main/resources/mapper/ContainerMapper.xml

@@ -32,9 +32,15 @@
             <if test="type != null and type != ''">
                 and a.type = #{type}
             </if>
+            <if test="code != null and code != ''">
+                and a.code = #{code}
+            </if>
             <if test="containerName != null and containerName != ''">
                 and a.container_name like CONCAT(CONCAT('%', #{containerName}), '%')
             </if>
+            <if test="department != null and department != ''">
+                and b.name like CONCAT(CONCAT('%', #{department}), '%')
+            </if>
         </trim>
         order by a.id desc
     </select>
@@ -103,7 +109,7 @@
     <!-- 新增报废日志 -->
     <insert id="addScrap">
         insert into tld_scrap(operation_name,scrap_cause,scrap_time,scrap_num,container_name)
-        values(#{operationName},#{scrapCause},DATE_FORMAT(NOW(), '%Y-%m-%d'),#{scrapNum},#{containerName})
+        values(#{operationName},#{scrapCause},NOW(),#{scrapNum},#{containerName})
     </insert>
     <!-- 查询报废日志 -->
     <select id="getScrap" resultType="com.tld.model.Scrap">
@@ -127,7 +133,11 @@
             <if test="containerName != null and containerName != ''">
                 and a.container_name = #{containerName}
             </if>
+            <if test="operationName != null and operationName != ''">
+                and b.user_name like CONCAT(CONCAT('%', #{operationName}), '%')
+            </if>
         </where>
+        order by a.id desc
     </select>
     <!-- 导出报废日志 -->
     <select id="exportScrap" resultType="java.util.LinkedHashMap">

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

@@ -288,7 +288,7 @@
         from ${tableName}
         where id = #{id}
     </delete>
-    <!--删除所有gs库存-->
+    <!--新增之前删除所有gs库存-->
     <delete id="deleteRepertory">
         delete
         from tld_inventory_gs

+ 67 - 0
src/main/resources/mapper/InventoryMapper.xml

@@ -275,6 +275,7 @@
                 and a.account_sleeve = #{accountSleeve}
             </if>
         </trim>
+        order by a.id desc
     </select>
     <!--查询本地库存.gs库存.录入库存 数量-->
     <select id="getInventoryLocality" resultType="java.util.Map">
@@ -314,4 +315,70 @@
               </if>
         </foreach>
     </select>
+    <!--盘点录入信息导出-->
+    <select id="exportEntering" resultType="java.util.LinkedHashMap">
+        select
+        a.wllb_code,
+        b.name as name ,
+        c.storage_location_name as storageLocationName,
+        a.total,
+        a.amount
+        from tld_plate a
+        left join tld_material b on a.wllb_code = b.code
+        left join tld_storage_location c on a.storage_location_code = c.storage_location_code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="wllbCodes != null and wllbCodes != ''">
+                and a.wllb_code  like CONCAT(CONCAT('%', #{wllbCodes}), '%')
+            </if>
+            <if test="name != null and name != ''">
+                and b.name  like CONCAT(CONCAT('%', #{name}), '%')
+            </if>
+            <if test="storageLocationName != null and storageLocationName != ''">
+                and c.storageLocationName  like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+            </if>
+            <if test="wllbCodes != null and wllbCodes != ''">
+                and a.wllb_code  like CONCAT(CONCAT('%', #{wllbCodes}), '%')
+            </if>
+            <if test="materialId != null and materialId != ''">
+                and a.material_id = #{materialId}
+            </if>
+            <if test="amount != null and amount != ''">
+                and a.amount = #{amount}
+            </if>
+            <if test="total != null and total != ''">
+                and a.total = #{total}
+            </if>
+            <if test="storageLocationCodes != null and storageLocationCodes != ''">
+                and a.storage_location_code like CONCAT(CONCAT('%', #{storageLocationCodes}), '%')
+            </if>
+            <if test="plateId != null and plateId != ''">
+                and a.plate_id = #{plateId}
+            </if>
+            <if test="accountSleeve != null and accountSleeve != ''">
+                and a.account_sleeve = #{accountSleeve}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id = #{supplierId}
+            </if>
+            <if test="serial != null and serial != ''">
+                and a.serial = #{serial}
+            </if>
+            <if test="attribute != null and attribute != ''">
+                and a.attribute = #{attribute}
+            </if>
+            <if test="uuid != null and uuid != ''">
+                and a.uuid = #{uuid}
+            </if>
+            <if test="scrq != null and scrq != ''">
+                and a.scrq like CONCAT(CONCAT('%', #{scrq}), '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.sqrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.sqrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by a.scrq desc
+    </select>
 </mapper>