zhs 2 vuotta sitten
vanhempi
commit
04dcb17bf2

+ 42 - 0
src/main/java/com/tld/controller/DeliveryController.java

@@ -2,6 +2,7 @@ package com.tld.controller;
 
 import com.tld.model.AskGoods;
 import com.tld.model.Delivery;
+import com.tld.model.EquipmentBindingSoftware;
 import com.tld.service.DeliveryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -101,4 +102,45 @@ public class DeliveryController {
         return deliveryService.delDelivery(id,request);
     }
 
+    /**
+     * 查询物料绑定软件
+     * @param equipmentBindingSoftware 参数
+     * @return 返回结果
+     */
+    @GetMapping("getEquipmentBindingSoftware")
+    public Map<String, Object> getEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware){
+        return deliveryService.getEquipmentBindingSoftware(equipmentBindingSoftware);
+    }
+
+    /**
+     * 新增物料绑定软件类
+     * @param equipmentBindingSoftware 参数
+     * @return 返回结果
+     */
+    @PostMapping("addEquipmentBindingSoftware")
+    public Map<String, Object> addEquipmentBindingSoftware(@RequestBody EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request){
+        return deliveryService.addEquipmentBindingSoftware(equipmentBindingSoftware, request);
+    }
+
+    /**
+     * 修改物料绑定
+     * @param equipmentBindingSoftware 参数
+     * @return 返回结果
+     */
+    @PutMapping("updateEquipmentBindingSoftware")
+    public Map<String, Object> updateEquipmentBindingSoftware(@RequestBody EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request){
+        return deliveryService.updateEquipmentBindingSoftware(equipmentBindingSoftware, request);
+    }
+
+    /**
+     * 删除绑定
+     * @param id 参数
+     * @return 返回结果
+     */
+    @DeleteMapping("delEquipmentBindingSoftware")
+    public Map<String, Object> delEquipmentBindingSoftware(String id){
+        return deliveryService.delEquipmentBindingSoftware(id);
+    }
+
+
 }

+ 1 - 0
src/main/java/com/tld/controller/GsPlugOutController.java

@@ -105,4 +105,5 @@ public class GsPlugOutController {
     public Map<String, Object> anew(@RequestBody Error error){
         return queryListService.anew(error);
     }
+
 }

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

@@ -21,6 +21,16 @@ public class WarehouseTransferController {
 //    @Autowired
     private final WarehouseTransferService warehouseTransferService;
 
+    /**
+     * 查询移库单编号
+     * @param warehouseTransfer 参数
+     * @return 返回结果
+     */
+    @GetMapping("getWarehouseTransferCode")
+    public Map<String, Object> getWarehouseTransferCode(WarehouseTransfer warehouseTransfer){
+        return warehouseTransferService.getWarehouseTransferCode(warehouseTransfer);
+    }
+
     /**
      * 查询移库单
      * @param warehouseTransfer 参数

+ 11 - 4
src/main/java/com/tld/mapper/DeliveryMapper.java

@@ -1,9 +1,6 @@
 package com.tld.mapper;
 
-import com.tld.model.AskGoods;
-import com.tld.model.Delivery;
-import com.tld.model.Inventory;
-import com.tld.model.MaterialClass;
+import com.tld.model.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -65,4 +62,14 @@ public interface DeliveryMapper {
     List<Delivery> getDeliveryCode(Delivery delivery);
 
     List<String> getDeliveryProjectName(Delivery delivery);
+
+    List<EquipmentBindingSoftware> getEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware);
+
+    void addEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware);
+
+    int getIsNotBinding(EquipmentBindingSoftware equipmentBindingSoftware);
+
+    void updateEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware);
+
+    void delEquipmentBindingSoftware(String id);
 }

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

@@ -44,4 +44,6 @@ public interface WarehouseTransferMapper {
     Inventory getInventoryVitrual(AskGoods askGoods);
 
     String getWarehouseTransferCodeType(String askGoodsWarehouseId);
+
+    List<WarehouseTransfer> getWarehouseTransferCode(WarehouseTransfer warehouseTransfer);
 }

+ 51 - 0
src/main/java/com/tld/model/EquipmentBindingSoftware.java

@@ -0,0 +1,51 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 产成品绑定软件类
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class EquipmentBindingSoftware implements Serializable {
+    /**
+     * id
+     */
+    private String id;
+    /**
+     * 设备物料号
+     */
+    private String equipmentCode;
+    /**
+     * 软件物料号
+     */
+    private String softwareCode;
+    /**
+     * 设备物料名称
+     */
+    private String equipmentName;
+    /**
+     * 软件物料名称
+     */
+    private String softwareName;
+    /**
+     * 最后修改人
+     */
+    private String modifyUser;
+    /**
+     * 最后修改时间
+     */
+    private String modifyTime;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+}

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

@@ -14,6 +14,10 @@ public class WarehouseTransfer {
      * 主键
      */
     private String id;
+    /**
+     * 移库通知单code
+     */
+    private String code;
     /**
      * 移库通知单id
      */
@@ -130,6 +134,10 @@ public class WarehouseTransfer {
      * 供货仓库状态
      */
     private String suppType;
+    /**
+     * 用户id
+     */
+    private String userId;
     /**
      * 是否推荐库位 产成品用
      */

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

@@ -2,6 +2,7 @@ package com.tld.service;
 
 import com.tld.model.AskGoods;
 import com.tld.model.Delivery;
+import com.tld.model.EquipmentBindingSoftware;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
@@ -22,4 +23,12 @@ public interface DeliveryService {
     Map<String, Object> getDeliveryCode(Delivery delivery);
 
     Map<String, Object> getDeliveryName(Delivery delivery);
+
+    Map<String, Object> getEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware);
+
+    Map<String, Object> addEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request);
+
+    Map<String, Object> updateEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request);
+
+    Map<String, Object> delEquipmentBindingSoftware(String id);
 }

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

@@ -19,4 +19,6 @@ public interface WarehouseTransferService {
     Map<String, Object> addAskGoodsVitrual(AskGoods askGoods);
 
     Map<String, Object> getMaterialCk(AskGoods askGoods);
+
+    Map<String, Object> getWarehouseTransferCode(WarehouseTransfer warehouseTransfer);
 }

+ 68 - 0
src/main/java/com/tld/service/impl/DeliveryServiceImpl.java

@@ -1,5 +1,7 @@
 package com.tld.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.tld.mapper.AskGoodsMapper;
 import com.tld.mapper.DeliveryMapper;
 import com.tld.mapper.DictionaryMapper;
@@ -382,6 +384,72 @@ public class DeliveryServiceImpl implements DeliveryService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> getEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            PageHelper.startPage(equipmentBindingSoftware.getPage(), equipmentBindingSoftware.getLimit());
+            PageInfo<EquipmentBindingSoftware> pageInfo = new PageInfo<>(deliveryMapper.getEquipmentBindingSoftware(equipmentBindingSoftware));
+            map.put("data", pageInfo);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> addEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            equipmentBindingSoftware.setModifyUser(request.getHeader("userId"));
+            int count = deliveryMapper.getIsNotBinding(equipmentBindingSoftware);
+            if(count > 0){
+                map.put("msg", "500");
+                map.put("errMsg", "此设备已经绑定过次软件,请勿重复绑定!");
+                return map;
+            }
+            deliveryMapper.addEquipmentBindingSoftware(equipmentBindingSoftware);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> updateEquipmentBindingSoftware(EquipmentBindingSoftware equipmentBindingSoftware, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            equipmentBindingSoftware.setModifyUser(request.getHeader("userId"));
+            deliveryMapper.updateEquipmentBindingSoftware(equipmentBindingSoftware);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> delEquipmentBindingSoftware(String id) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            deliveryMapper.delEquipmentBindingSoftware(id);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
     /**
      * 出库单生成
      * @return

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

@@ -384,6 +384,21 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> getWarehouseTransferCode(WarehouseTransfer warehouseTransfer) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<WarehouseTransfer> list = warehouseTransferMapper.getWarehouseTransferCode(warehouseTransfer);
+            map.put("data", list);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "失败");
+        }
+        return map;
+    }
+
     /**
      * 移库单生成
      * @return

+ 57 - 1
src/main/resources/mapper/DeliveryMapper.xml

@@ -14,7 +14,12 @@
         WHERE
             ( a.gs_delivery_num - a.gs_cancel_num ) != a.out_num
 	AND a.STATUS != '1' and c.code in (select material_id from tld_user_material where user_id = #{userId})
-    AND b.project_name = #{projectName}
+    <if test="projectName == ' '.toString()">
+        AND b.project_name is null
+    </if>
+    <if test="projectName != ' '.toString()">
+        AND b.project_name = #{projectName}
+    </if>
     </select>
     <!-- 查询销售单项目名称 -->
     <select id="getDeliveryProjectName" resultType="String">
@@ -359,4 +364,55 @@
         join tld_material b on a.equipment_code = b.code
         where a.equipment_code = #{code}
     </select>
+    <!-- 查询产成品绑定的软件类 -->
+    <select id="getEquipmentBindingSoftware" resultType="com.tld.model.EquipmentBindingSoftware">
+        SELECT
+            a.id,
+            a.equipment_code,
+            a.software_code,
+            b.name as equipmentName,
+            c.name as softwareName
+        FROM
+            tld_equipment_binding_software a
+            JOIN tld_material b ON a.equipment_code = b.code
+            JOIN tld_material c ON a.software_code = c.code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="equipmentCode != null and equipmentCode != ''">
+                AND equipment_code = #{equipmentCode}
+            </if>
+            <if test="softwareCode != null and softwareCode != ''">
+                AND software_code = #{softwareCode}
+            </if>
+        </trim>
+        order by id desc
+    </select>
+    <!-- 查询是否绑定 -->
+    <select id="getIsNotBinding" resultType="java.lang.Integer">
+        select count(*) from tld_equipment_binding_software where equipment_code = #{equipmentCode} and software_code = #{softwareCode}
+    </select>
+    <!-- 新增产成品绑定软件 -->
+    <insert id="addEquipmentBindingSoftware">
+        INSERT INTO tld_equipment_binding_software(equipment_code,software_code,modify_user,modify_time)
+        value(#{equipmentCode},#{softwareCode},#{modifyUser},now())
+    </insert>
+    <!-- 修改产成品绑定软件 -->
+    <update id="updateEquipmentBindingSoftware">
+        update tld_equipment_binding_software
+        <set>
+            <trim suffixOverrides=",">
+                <if test="equipmentCode != null">
+                    equipment_code = #{equipmentCode},
+                </if>
+                <if test="softwareCode != null">
+                    software_code = #{softwareCode},
+                </if>
+                modify_user = #{modifyUser},modify_time=now(),
+            </trim>
+        </set>
+        where id = #{id}
+    </update>
+    <!-- 删除绑定 -->
+    <delete id="delEquipmentBindingSoftware">
+        delete from tld_equipment_binding_software where id = #{id}
+    </delete>
 </mapper>

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

@@ -608,7 +608,7 @@
         select
         b.delivery_code,
         a.material_id,
-        a.wbs,
+        if(a.wbs = '', null, a.wbs) as wbs,
         a.gs_delivery_num,
         a.gs_cancel_num,
         a.out_num,

+ 2 - 2
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -94,7 +94,7 @@
         insert into tld_receive_goods(order_code, material_id, purchase_num, arrival_num, type, qualified_num,
                                       disqualification_num, wbs, arrival_time, measurement_id, supplier_id,
                                       entry_number, warehousing_num)
-        values (#{orderCode}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{type}, #{qualifiedNum},
+        values (#{orderCode}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{type}, 0+CAST(#{qualifiedNum} as char),
                 #{disqualificationNum}, #{wbs}, #{arrivalTime}, #{measurementId}, #{supplierId}, #{entryNumber}, '0');
     </insert>
     <!-- 新增采购单信息 -->
@@ -155,7 +155,7 @@
                                           order_type, source_type, move_type, material_id, purchase_num, arrival_num,
                                           qualified_num, disqualification_num, wbs, measurement_id)
         values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType},
-                #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{qualifiedNum},
+                #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, 0+CAST(#{qualifiedNum} as char),
                 #{disqualificationNum}, #{wbs}, #{measurementId})
     </insert>
     <!-- 新增采购到料大屏信息 -->

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

@@ -33,6 +33,12 @@
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
         join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="userId != null and userId != ''">
+                and c.code in (select material_id from tld_user_material where user_id = #{userId})
+            </if>
+            <if test="warehouseTransferId != null and warehouseTransferId != ''">
+                and a.warehouse_transfer_id = #{warehouseTransferId}
+            </if>
             <if test="type != null and type != ''">
                 and a.type = #{type}
             </if>
@@ -237,4 +243,14 @@
         WHERE
             tld_id = #{askGoodsWarehouseId}
     </select>
+    <!-- 查询移库单编号 -->
+    <select id="getWarehouseTransferCode" resultType="com.tld.model.WarehouseTransfer">
+        SELECT
+            DISTINCT b.warehouse_transfer_id as id,b.warehouse_transfer_code as code
+        FROM
+            tld_warehouse_transfer a
+            JOIN tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
+            JOIN tld_material c on a.material_id = c.tld_id
+        WHERE c.code IN (select material_id from tld_user_material where user_id = #{userId}) and (a.num + 0) <![CDATA[>]]> (a.out_num + 0)
+    </select>
 </mapper>

+ 2 - 5
src/main/resources/mapper/WarehousingMapper.xml

@@ -322,17 +322,14 @@
             a.wllb_code as wllbCode,
             h.name as supplierName,
             if(a.serial = '', null ,a.serial) as serial,
-            if(a.produc_date = '', null ,a.produc_date) as producDate,
-            if(a.produc_batch = '', null ,a.produc_batch) as producbatch,
             a.capacity,
-            a.seq,
             a.type,
             c.user_name as userName,
             e.name as departmentName,
             g.storage_location_name as storageLocationName,
             a.scrq,
             a.storage_code,
-            a.wbs,
+            e.code as wbs,
             c.real_name as realName,
             a.order_code as orderCode,
             f.name as accountName,
@@ -341,7 +338,7 @@
         from tld_storage a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
-        left join tld_department e on a.department_id = e.code
+        left JOIN tld_wbs e ON a.wbs = e.code
         left join tld_storage_location g on a.storage_location_code = g.storage_location_code
         left join tld_customer h on a.supplier_id = h.code
         left join tld_company f on a.account_sleeve = f.code