瀏覽代碼

问题修改

xiaochen 2 年之前
父節點
當前提交
d3e7051ced

+ 1 - 1
src/main/java/com/tld/controller/GsAccessController.java

@@ -119,7 +119,7 @@ public class GsAccessController {
     }
 
     /**
-     * 交货单接口
+     * 交货单接口/销售交货出库
      * @param mapList 参数
      * @return 返回结果
      */

+ 7 - 0
src/main/java/com/tld/mapper/InviteMapper.java

@@ -81,4 +81,11 @@ public interface InviteMapper {
 
     void addWarehouseTransfer(List<Map<String, Object>> List);
 
+    int getCountDelivery(@Param("deliveryOrderId") String deliveryOrderId);
+
+
+    void updDelivery(@Param("deliveryOrderId") String deliveryOrderId);
+
+    void addDeliverys(Map<String, Object> list);
+
 }

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

@@ -60,6 +60,10 @@ public class MaterialClass implements Serializable {
      * 物料类别
      */
     private String partType;
+    /**
+     * 所在仓库
+     */
+    private String warehouseWhere;
     /**
      * 最少数量
      */

+ 17 - 1
src/main/java/com/tld/service/impl/InviteServiceImpl.java

@@ -211,7 +211,23 @@ public class InviteServiceImpl implements InviteService {
     public Map<String, Object> deliveryOrder(List<Map<String, Object>> mapList) {
         Map<String, Object> map = new HashMap<>();
         try {
-            inviteMapper.addDelivery(mapList);
+            for (Map<String, Object> list : mapList) {
+                if (list.get("operationType").toString().equals("2")){
+                    //查询子表数据根据交货单id
+                    int count =  inviteMapper.getCountDelivery(list.get("deliveryOrderId").toString());
+                    //是否存在
+                    if (count == 0){
+                        //修改父子表信息
+                        inviteMapper.updDelivery(list.get("deliveryOrderId").toString());
+                        //添加
+                        inviteMapper.addDeliverys(list);
+                    }
+                }else {
+                    //添加
+                    inviteMapper.addDeliverys(list);
+                }
+            }
+//            inviteMapper.addDelivery(mapList);
             //新增日志
             Access access = new Access().setType("交货单").setData(JSON.toJSONString(mapList)).setAccessType("0");
             dictionaryMapper.addAccess(access);

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

@@ -96,7 +96,7 @@ public class MaterialClassServiceImpl implements MaterialClassService {
                 return map ;
             }
             String wllbCode = materialClassMapper.getMaterialClassStorageLocation(materialClass.getStorageLocationCode());
-            if(!wllbCode.equals(materialClass.getWllbCode()) && !wllbCode.equals("")){
+            if( wllbCode != null && !wllbCode.equals(materialClass.getWllbCode())){
                 map.put("msg", "500");
                 map.put("errMsg", "库位已被占用");
                 return map;

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

@@ -271,7 +271,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料ID", "物料名称", "物料编号", "WBS", "移库数量", "已移库数量", "要货仓库ID", "出货仓库ID", "要货仓库名称", "出货仓库名称", "单据日期");
+            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料ID", "物料名称", "物料编号", "WBS", "移库数量", "已移库数量", "要货仓库ID", "出货仓库ID", "要货仓库名称", "出货仓库名称", "单据日期","状态");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getWarehouseTransferExcel(warehouseTransfer);
             sheetDataList.add(head);

+ 28 - 0
src/main/resources/mapper/InviteMapper.xml

@@ -210,6 +210,12 @@
     <delete id="deleteVirtual">
         delete from tld_ask_goods_vitrual where id = #{id}
     </delete>
+    <!-- 删除交货单接口/销售交货出库记录 -->
+    <delete id="updDelivery">
+        delete from tld_delivery_f where delivery_id = #{deliveryOrderId};
+        delete from tld_delivery where delivery_id = #{deliveryOrderId};
+    </delete>
+
     <!-- 插入出库流水 -->
     <insert id="addRemoval">
         insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department)
@@ -332,6 +338,25 @@
         </foreach>
         ;
     </insert>
+    <!-- 交货单接口 -->
+    <insert id="addDeliverys">
+        insert into tld_delivery_f (delivery_id, delivery_code, company_number, customer_code, bills_time, delivery_type,source_type,move_type)
+        values
+            (#{deliveryOrderId},#{deliveryOrderNo},#{companyNumber},#{customerNo},#{docDate},#{deloveryGoodsType},#{sourceType},#{moveType})
+        ;
+        insert into tld_delivery ( delivery_id, entry_number, material_id, wbs, measurement_id, gs_delivery_num, gs_cancel_num, out_num )
+        values
+        <foreach collection="datalist" index="index" item="items" separator=",">
+            (#{items.deliveryOrderId},#{items.entryNumber},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.gsDeliveryCount},#{items.gsCancelDeliveryCount},0)
+        </foreach>
+        ;
+        insert into tld_delivery_log (delivery_id, delivery_code, company_number, customer_code, bills_time, delivery_type,source_type,move_type, entry_number, material_id, wbs, measurement_id, gs_delivery_num, gs_cancel_num, out_num )
+        values
+        <foreach collection="datalist" index="index" item="items" separator=",">
+            (#{deliveryOrderId},#{deliveryOrderNo},#{companyNumber},#{customerNo},#{docDate},#{deloveryGoodsType},#{sourceType},#{moveType},#{items.entryNumber},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.gsDeliveryCount},#{items.gsCancelDeliveryCount},0)
+        </foreach>
+        ;
+    </insert>
     <!-- 查询当天出库数量 -->
     <select id="getReturnRemovalCount" resultType="int">
         select count(*) from tld_return_gs_removal where scrq BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
@@ -425,6 +450,9 @@
             </if>
         </trim>
     </select>
+    <select id="getCountDelivery" resultType="java.lang.Integer">
+        select COUNT(*) from  tld_delivery where delivery_id = #{deliveryOrderId} and out_num > 0
+    </select>
     <!-- 修改出库数量 -->
     <update id="updateOutNum">
         update tld_invite

+ 1 - 0
src/main/resources/mapper/MaterialClassMapper.xml

@@ -8,6 +8,7 @@
             DISTINCT a.wllb_code,
             a.storage_location_code,
             b.storage_location_name as storageLocationName,
+            b.warehouse_where as warehouseWhere,
             c.name as wllbName,
             a.id,
             a.modify_time as modifyTime,

+ 18 - 8
src/main/resources/mapper/QueryListMappeer.xml

@@ -126,7 +126,8 @@
             e.NAME AS materialName,
             e.CODE AS materialCode,
             b.ask_goods_code,
-            b.company_number
+            b.company_number,
+            b.sqrq
         FROM
             tld_ask_goods a
             JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
@@ -134,7 +135,7 @@
             JOIN tld_material e ON a.material_id = e.tld_id
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         <if test="askGoodsId != null and askGoodsId != ''">
-            and a.ask_goods_id = #{askGoodsId}
+            and b.ask_goods_code = #{askGoodsId}
         </if>
         <if test="materialCode != null and materialCode != ''">
             and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
@@ -193,7 +194,8 @@
             e.NAME AS materialName,
             e.CODE AS materialCode,
             b.ask_goods_code,
-            b.company_number
+            b.company_number,
+            b.sqrq
         FROM
             tld_invite a
             JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
@@ -201,7 +203,7 @@
             JOIN tld_material e ON a.material_id = e.tld_id
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         <if test="askGoodsId != null and askGoodsId != ''">
-            and a.ask_goods_id = #{askGoodsId}
+            and b.ask_goods_code = #{askGoodsId}
         </if>
         <if test="materialCode != null and materialCode != ''">
             and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
@@ -336,13 +338,13 @@
             b.warehouse_transfer_type,
             c.name as materialName,
             c.code as materialCode,
-            f.name as askGoodsWarehouseaName,
+            f.name as askGoodsWarehouseName,
             e.name as supplyWarehouseName
         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
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
-        join tld_warehouse f on a.ask_goods_warehouse_id = f.tld_id
+        join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
                 and a.type = #{type}
@@ -353,6 +355,9 @@
             <if test="materialName != null and materialName != ''">
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
+            <if test="warehouseTransferCode != null and warehouseTransferCode != ''">
+                and b.warehouse_transfer_code like CONCAT(CONCAT('%', #{warehouseTransferCode}), '%')
+            </if>
             <if test="startTime != null and startTime != ''">
                 and a.document_time <![CDATA[>=]]> #{startTime}
             </if>
@@ -377,12 +382,17 @@
             f.name as askGoodsWarehouseaName,
             e.name as supplyWarehouseName,
             b.document_time,
-            a.type
+            case
+            when a.type = '0' then
+            '未移库'
+            when a.type = '1' then
+            '已移库'
+            end as type
         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
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
-        join tld_warehouse f on a.ask_goods_warehouse_id = f.tld_id
+        join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
                 and a.type = #{type}