zhs 2 лет назад
Родитель
Сommit
2db913bfc4
23 измененных файлов с 233 добавлено и 41 удалено
  1. 11 0
      src/main/java/com/tld/controller/AskGoodsController.java
  2. 0 7
      src/main/java/com/tld/controller/GsAccessController.java
  3. 2 2
      src/main/java/com/tld/controller/WarehousingController.java
  4. 2 0
      src/main/java/com/tld/mapper/AskGoodsMapper.java
  5. 2 0
      src/main/java/com/tld/mapper/DictionaryMapper.java
  6. 2 0
      src/main/java/com/tld/mapper/MaterialClassMapper.java
  7. 7 1
      src/main/java/com/tld/mapper/WarehousingMapper.java
  8. 4 0
      src/main/java/com/tld/model/AskGoods.java
  9. 4 0
      src/main/java/com/tld/model/Dictionary.java
  10. 4 0
      src/main/java/com/tld/model/Menu.java
  11. 8 0
      src/main/java/com/tld/model/Notice.java
  12. 2 0
      src/main/java/com/tld/service/AskGoodsService.java
  13. 1 1
      src/main/java/com/tld/service/WarehousingService.java
  14. 62 2
      src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java
  15. 8 0
      src/main/java/com/tld/service/impl/DictionaryServiceImpl.java
  16. 7 0
      src/main/java/com/tld/service/impl/MaterialClassServiceImpl.java
  17. 32 12
      src/main/java/com/tld/service/impl/WarehousingServiceImpl.java
  18. 29 3
      src/main/resources/mapper/AskGoodsMapper.xml
  19. 4 0
      src/main/resources/mapper/DictionaryMapper.xml
  20. 5 0
      src/main/resources/mapper/MaterialClassMapper.xml
  21. 8 4
      src/main/resources/mapper/MenuMapper.xml
  22. 2 3
      src/main/resources/mapper/WarehouseTransferMapper.xml
  23. 27 6
      src/main/resources/mapper/WarehousingMapper.xml

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

@@ -156,4 +156,15 @@ public class AskGoodsController {
     public void getRemovalHalfExcel(AskGoods askGoods, HttpServletResponse response){
         askGoodsService.getRemovalHalfExcel(askGoods, response);
     }
+
+    /**
+     * 其他出库
+     * @param askGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("otherAskGoods")
+    public Map<String, Object> otherAskGoods(AskGoods askGoods){
+        return askGoodsService.otherAskGoods(askGoods);
+    }
+
 }

+ 0 - 7
src/main/java/com/tld/controller/GsAccessController.java

@@ -62,13 +62,6 @@ public class GsAccessController {
     }
 
 
-    @PostMapping("test")
-    @PassToken
-    public void test(@RequestBody JSONObject jsonData){
-        //return receiveGoodsSerivce.addReceiveGoods(jsonData);
-        System.out.println(jsonData.toJSONString());
-    }
-
     /**
      * 质检确认
      * @param receiveGoods 参数

+ 2 - 2
src/main/java/com/tld/controller/WarehousingController.java

@@ -50,8 +50,8 @@ public class WarehousingController {
      * @return 返回接结果
      */
     @GetMapping("getWarehousingVirtual")
-    public Map<String, Object> addWarehousingVirtual(String uniqueCode){
-        return warehousingService.getWarehousingVirtual(uniqueCode);
+    public Map<String, Object> getWarehousingVirtual(String uniqueCode, String type){
+        return warehousingService.getWarehousingVirtual(uniqueCode, type);
     }
 
     /**

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

@@ -90,4 +90,6 @@ public interface AskGoodsMapper {
     List<AskGoods> getRemovalHalf(AskGoods askGoods);
 
     List<Map<String, Object>> getRemovalHalfExcel(AskGoods askGoods);
+
+    Inventory getInventoryInfo(AskGoods askGoods);
 }

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

@@ -25,4 +25,6 @@ public interface DictionaryMapper {
     String getWarehouse(String storageLocationCode);
 
     Dictionary getWarehouseInfo(WarehouseTransfer warehouseTransfer);
+
+    int getInventorySumAmount(Dictionary dictionary1);
 }

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

@@ -16,4 +16,6 @@ public interface MaterialClassMapper {
     void updateMaterialClass(MaterialClass materialClass);
 
     void updateMaterial(MaterialClass materialClass);
+
+    int getMaterialClassStorageLocation(String storageLocationCode);
 }

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

@@ -47,7 +47,7 @@ public interface WarehousingMapper {
 
     List<Storage> warehousingFlowing(Storage storage);
 
-    List<WarehousingVirtual> getWarehousingVirtual(String uniqueCode);
+    List<WarehousingVirtual> getWarehousingVirtual(@Param("uniqueCode")String uniqueCode, @Param("type")String type);
 
     List<Map<String, Object>> export(Storage storage);
 
@@ -96,4 +96,10 @@ public interface WarehousingMapper {
     List<Notice> getHalf(Notice notice);
 
     List<Map<String, Object>> getHalfExcel(Notice notice);
+
+    int getSumScanNumVal(Notice notice1);
+
+    void updateNotice(Notice notice2);
+
+    Map<String, Object> getScanIsNotProduct(Notice notice);
 }

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

@@ -184,4 +184,8 @@ public class AskGoods implements Serializable {
      * 所属仓库
      */
     private String warehouseWhere;
+    /**
+     * 公司名称
+     */
+    private String companyName;
 }

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

@@ -83,4 +83,8 @@ public class Dictionary  implements Serializable {
      * 条数
      */
     private int limit;
+    /**
+     * 物料库存数量
+     */
+    private String amount;
 }

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

@@ -53,5 +53,9 @@ public class Menu implements Serializable {
      * 菜单
      */
     private String menu;
+    /**
+     * 图表
+     */
+    private String img;
 
 }

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

@@ -148,5 +148,13 @@ public class Notice implements Serializable {
      * 物料类别
      */
     private String partType;
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+    /**
+     * 数量
+     */
+    private String capacity;
 
 }

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

@@ -38,4 +38,6 @@ public interface AskGoodsService {
     Map<String, Object> getRemovalHalf(AskGoods askGoods);
 
     void getRemovalHalfExcel(AskGoods askGoods, HttpServletResponse response);
+
+    Map<String, Object> otherAskGoods(AskGoods askGoods);
 }

+ 1 - 1
src/main/java/com/tld/service/WarehousingService.java

@@ -20,7 +20,7 @@ public interface WarehousingService {
 
     Map<String, Object> warehousingFlowing(Storage storage);
 
-    Map<String, Object> getWarehousingVirtual(String uniqueCode);
+    Map<String, Object> getWarehousingVirtual(String uniqueCode, String type);
 
     void export(Storage storage, HttpServletResponse response);
 

+ 62 - 2
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo;
 import com.tld.excel.ExcelUtils;
 import com.tld.mapper.AskGoodsMapper;
 import com.tld.mapper.ErrorMapper;
+import com.tld.mapper.WarehousingMapper;
 import com.tld.model.*;
 import com.tld.model.Error;
 import com.tld.service.AskGoodsService;
@@ -30,7 +31,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
     //redis锁
     @Autowired
     private RedissonClient redissonClient;
-
+    //入库
+    @Autowired
+    private WarehousingMapper warehousingMapper;
     @Autowired
     private ErrorMapper errorMapper;
 
@@ -464,7 +467,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "出库数量", "用户名称", "出库时间", "公司编号", "客户编号");
+            List<Object> head = Arrays.asList("物料名称", "出库数量", "用户名称", "出库时间", "公司名称", "客户名称");
             //查询数据
             PageHelper.startPage(askGoods.getPage(), askGoods.getLimit());
             PageInfo<Map<String, Object>> list = new PageInfo<>(askGoodsMapper.getRemovalHalfExcel(askGoods));
@@ -485,6 +488,63 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         }
     }
 
+    @Override
+    public Map<String, Object> otherAskGoods(AskGoods askGoods) {
+        Map<String, Object> map = new HashMap<>();
+        //redis并发锁
+        RLock lock = redissonClient.getLock(askGoods.getWllbCode() + askGoods.getStorageLocationCode());
+        lock.lock();
+        try{
+            //查询物料信息
+            MaterialClass material = warehousingMapper.getMaterial(new Notice().setMaterialCode(askGoods.getWllbCode()));
+            askGoods.setMaterialId(material.getTldId());
+            if(material.getPartType().equals("半成品")){
+                askGoods.setStorageLocationCode("000000");
+            } else if(material.getPartType().equals("产成品") && material.getIsRecommend().equals("0")){
+                askGoods.setStorageLocationCode("111111");
+            }
+            //查询库存
+            Inventory inventory = askGoodsMapper.getInventoryInfo(askGoods);
+            if(inventory == null){
+                map.put("msg", "500");
+                map.put("errMsg", "未查询到该库位的库存");
+                return map;
+            }
+            if(Integer.parseInt(inventory.getAmount()) < Integer.parseInt(askGoods.getNum())){
+                map.put("msg", "500");
+                map.put("errMsg", "库存数量不足");
+                return map;
+            }
+            //如果出库库存等于虚拟表库存则删除此库存
+            if(Integer.parseInt(askGoods.getNum()) == Integer.parseInt(inventory.getAmount())){
+                askGoodsMapper.deleteInventory(inventory);
+            } else {
+                inventory.setAmount(askGoods.getNum());
+                askGoodsMapper.updateInventory(inventory);
+            }
+            //新增返回gs信息
+            String removalCode = codeGenerateCk();
+            ReturRemoval returRemoval = new ReturRemoval()
+                    .setMaterialId(material.getTldId())
+                    .setWbs(askGoods.getWbs())
+                    .setNum(askGoods.getNum())
+                    .setStorageLocationCode(inventory.getStorageLocationCode())
+                    .setRemovalCode(removalCode)
+                    .setSourceType("0")
+                    .setMoveType("209");
+            askGoodsMapper.addReturnGsRemovalF(returRemoval);//新增返回gs数据父表信息
+            askGoodsMapper.addReturnGsRemoval(returRemoval);//新增返回gs数据子表信息
+        }catch (Exception e){
+            map.put("msg", "500");
+            map.put("errMsg", "失败");
+            e.printStackTrace();
+        } finally {
+            //释放锁
+            lock.unlock();
+        }
+        return map;
+    }
+
     /**
      * 出库单生成
      * @return

+ 8 - 0
src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

@@ -73,12 +73,20 @@ public class DictionaryServiceImpl implements DictionaryService {
     public Map<String, Object> getDictionaryPage(Dictionary dictionary) {
         Map<String, Object> map = new HashMap<>();
         try{
+            Map<String, Object> amountMap = new HashMap<>();
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             dictionary.setTableName(tableName);
             PageHelper.startPage(dictionary.getPage(), dictionary.getLimit());
             PageInfo<Dictionary> list = new PageInfo<>(dictionaryMapper.getDictionaryPage(dictionary));
+            if(dictionary.getType().equals("物料字典")){
+                for(Dictionary dictionary1 : list.getList()){
+                    int amount = dictionaryMapper.getInventorySumAmount(dictionary1);
+                    amountMap.put(dictionary1.getTldId(), amount);
+                }
+            }
             map.put("msg", "200");
             map.put("data", list);
+            map.put("amount", amountMap);
         }  catch (Exception e){
             e.printStackTrace();
             map.put("msg", "500");

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

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
@@ -54,6 +55,12 @@ public class MaterialClassServiceImpl implements MaterialClassService {
     public Map<String, Object> addMaterialClass(MaterialClass materialClass) {
         Map<String, Object> map = new HashMap<>();
         try{
+            int count = materialClassMapper.getMaterialClassStorageLocation(materialClass.getStorageLocationCode());
+            if(count > 0){
+                map.put("msg", "500");
+                map.put("errMsg", "库位已被占用");
+                return map;
+            }
             materialClassMapper.addMaterialClass(materialClass);
             map.put("msg", "200");
         }catch (Exception e){

+ 32 - 12
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -8,6 +8,7 @@ import com.mysql.cj.xdevapi.JsonString;
 import com.tld.excel.ExcelUtils;
 import com.tld.mapper.*;
 import com.tld.model.*;
+import com.tld.model.Dictionary;
 import com.tld.model.Error;
 import com.tld.service.WarehousingService;
 import com.tld.util.DateUtil;
@@ -88,17 +89,17 @@ public class WarehousingServiceImpl implements WarehousingService {
             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(materialClass.getSize()))){
                     //查询库存是否同物料同批次存在
                     List<String> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
                     if(countProduc.size() == 0){
                         stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
-                        int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
+                        int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
                         listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
                     } else {
                         if(String.valueOf(countProduc.get(0)).equals(producDate)){
                             stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
-                            int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
+                            int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
                             listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
                         }
                     }
@@ -291,10 +292,10 @@ public class WarehousingServiceImpl implements WarehousingService {
     }
 
     @Override
-    public Map<String, Object> getWarehousingVirtual(String uniqueCode) {
+    public Map<String, Object> getWarehousingVirtual(String uniqueCode, String type) {
         Map<String, Object> map = new HashMap<>();
         try{
-            List<WarehousingVirtual> list = warehousingMapper.getWarehousingVirtual(uniqueCode);
+            List<WarehousingVirtual> list = warehousingMapper.getWarehousingVirtual(uniqueCode, type);
             map.put("data", list);
             map.put("msg", "200");
         } catch (Exception e){
@@ -336,10 +337,16 @@ public class WarehousingServiceImpl implements WarehousingService {
     public Map<String, Object> getNotice(Notice notice) {
         Map<String, Object> map = new HashMap<>();
         try{
+            Map<String, Object> sumScanNum = new HashMap<>();
             PageHelper.startPage(notice.getPage(), notice.getLimit());
             PageInfo<Notice> list = new PageInfo<>(warehousingMapper.getNotice(notice));
+            for(Notice notice1 : list.getList()){
+                int sumScanNumVal = warehousingMapper.getSumScanNumVal(notice1);
+                sumScanNum.put(notice1.getNoticeId(), sumScanNumVal);
+            }
             map.put("data", list);
             map.put("msg", "200");
+            map.put("sumScanNum", sumScanNum);
         } catch (Exception e){
             e.printStackTrace();
             map.put("msg", "500");
@@ -453,11 +460,11 @@ public class WarehousingServiceImpl implements WarehousingService {
             String removalCode = codeGenerateCk();
             ReturRemoval returRemoval = new ReturRemoval()
                     .setMaterialId(notice.getMaterialId())
-                    .setAskGoodsId(notice.getAskGoodsId())
+                    .setDocumentId(notice.getAskGoodsId())
                     .setWbs(askGoods.getWbs())
                     .setNum(notice.getWarehousingNum())
                     .setEntryNumber(askGoods.getEntryNumber())
-                    .setAskId(askGoods.getId())
+                    .setDocumentPointsId(askGoods.getId())
                     .setStorageLocationCode(inventory.getStorageLocationCode())
                     .setRemovalCode(removalCode)
                     .setSourceType(askGoods.getSourceType())
@@ -529,6 +536,12 @@ public class WarehousingServiceImpl implements WarehousingService {
                 map.put("errMsg", "物料信息未录入,请联系管理员");
                 return map;
             }
+            Map<String, Object> mapVal = warehousingMapper.getScanIsNotProduct(notice);
+            if(Integer.parseInt(mapVal.get("inventoryCount").toString()) != 0 || Integer.parseInt(mapVal.get("virtualCount").toString()) != 0){
+                map.put("msg", "500");
+                map.put("errMsg", "已被扫描");
+                return map;
+            }
             notice.setWllbClass(material.getWllbClass());
             StringBuffer stringBuffer = new StringBuffer();//库位编号
             Map<String, Object> listMap = new HashMap<>();
@@ -540,15 +553,15 @@ public class WarehousingServiceImpl implements WarehousingService {
                     for(StorageLocation storageLocation1 : storageLocations){
                         Inventory inventory = warehousingMapper.getInventoryInfo(storageLocation1);//查询库存信息
                         if(inventory == null){
-                            stringBuffer.append(storageLocation1.getStorageLocationCode());
+                            stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
                             continue;
                         }
                         //判断剩余容量大于入库数量
-                        int num = (int) (Double.parseDouble(storageLocation1.getStorageLocationCapacity()) - Double.parseDouble(inventory.getAmount()));
+                        int num = (int) (Double.parseDouble(material.getSize()) - Double.parseDouble(inventory.getAmount()));
                         if(Integer.parseInt(notice.getWarehousingNum()) < num){
                             //同一属性 同一批次推荐
                             if(inventory.getAttribute().equals(notice.getAttribute()) && inventory.getProducBatch().equals(notice.getProducBatch())){
-                                stringBuffer.append(storageLocation1.getStorageLocationCode());
+                                stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
                                 listMap.put(storageLocation1.getStorageLocationCode(), num);
                             }
                         }
@@ -556,6 +569,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                     List<StorageLocation> list = warehousingMapper.recommend(stringBuffer.toString());
                     map.put("data", list);
                     map.put("listString", listMap);//返回库位剩余数量
+                    map.put("msg", "210");
                 } else {
                     notice.setStorageLocationCode("111111");
                     if(warehousingMapper.getInventoryNotice(notice) != 0){
@@ -563,6 +577,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                     } else {
                         warehousingMapper.addInventoryNotice(notice);
                     }
+                    warehousingMapper.updateNotice(notice);//修改报工单数量
                     //入库流水
                     WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
                             .setWllbCode(material.getWllbCode())
@@ -609,7 +624,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //查询入库所需要的信息
             for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtualNotice(uniqueCode, type, noticeId)) {
                 //查询物料信息
-                Notice notice = new Notice().setWllbCode(warehousingVirtual.getWllbCode());
+                Notice notice = new Notice().setMaterialCode(warehousingVirtual.getWllbCode());
                 MaterialClass material = warehousingMapper.getMaterial(notice);
                 Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(noticeId).setMaterialId(material.getTldId()));
                 Notice notice2 = new Notice()
@@ -621,8 +636,13 @@ public class WarehousingServiceImpl implements WarehousingService {
                         .setProducBatch(warehousingVirtual.getProducDate())
                         .setWllbClass(material.getWllbClass())
                         .setWbs(notice1.getWbs())
+                        .setCompanyNumber(notice1.getCompanyNumber())
+                        .setSupplierId(warehousingVirtual.getSuppId())
+                        .setSerial(warehousingVirtual.getSerial())
+                        .setWllbCode(material.getWllbCode())
                         .setCompanyNumber(notice1.getCompanyNumber());
-                warehousingMapper.addInventoryNotice(notice2);
+                warehousingMapper.addInventoryNotice(notice2);//入库存
+                warehousingMapper.updateNotice(notice2);//修改报工单数量
                 //入库流水
                 WarehousingVirtual warehousingVirtual1 = new WarehousingVirtual()
                         .setWllbCode(material.getWllbCode())

+ 29 - 3
src/main/resources/mapper/AskGoodsMapper.xml

@@ -453,11 +453,13 @@
             a.customer_code,
             b.name as materialName,
             c.user_name as userName,
-            e.name as customerName
+            e.name as customerName,
+            f.name as companyName
         from tld_removal_half 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_customer e on a.customer_code = e.code
+        left join tld_company f on a.company_number = f.tld_id
         <if test="wllbCode != null and wllbCode != ''">
             and a.wllb_code = #{wllbCode}
         </if>
@@ -474,14 +476,15 @@
         select
             b.name as materialName,
             a.num,
-            c.user_name as userName
+            c.user_name as userName,
             a.scrq,
-            a.company_number,
+            f.name as companyName,
             e.name
         from tld_removal_half 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_customer e on a.customer_code = e.code
+        left join tld_company f on a.company_number = f.tld_id
         <if test="wllbCode != null and wllbCode != ''">
             and a.wllb_code = #{wllbCode}
         </if>
@@ -493,4 +496,27 @@
         </if>
         order by a.scrq desc
     </select>
+    <!-- 查询指定物料的库存 -->
+    <select id="getInventoryInfo" resultType="com.tld.model.Inventory">
+        select
+            storage_location_code,
+            wllb_class,
+            library_type,
+            material_id,
+            amount,
+            total,
+            totime,
+            hold,
+            amount_lock,
+            account_sleeve,
+            wbs,
+            supplier_id,
+            serial,
+            wllb_code,
+            produc_date,
+            scrq,
+            produc_batch,
+            attribute
+        from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
+    </select>
 </mapper>

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

@@ -62,4 +62,8 @@
     <select id="getWarehouseInfo" resultType="com.tld.model.Dictionary">
         select code,name,tld_id from tld_warehouse where code = #{askGoodsWarehouseId}
     </select>
+    <!-- 查询物料库存内容 -->
+    <select id="getInventorySumAmount" resultType="int">
+        select ifnull(sum(amount), 0) from tld_inventory where material_id = #{tldId}
+    </select>
 </mapper>

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

@@ -24,6 +24,7 @@
                and a.wllb_code = #{wllbCode}
            </if>
        </trim>
+        order by a.id desc
    </select>
     <!-- 删除类别表 -->
     <delete id="delMaterialClass">
@@ -72,4 +73,8 @@
         </set>
         where tld_id = #{id}
     </update>
+    <!-- 查询库位是否被占用 -->
+    <select id="getMaterialClassStorageLocation" resultType="int">
+        select count(*) from tld_material_class where storage_location_code = #{storageLocationCode}
+    </select>
 </mapper>

+ 8 - 4
src/main/resources/mapper/MenuMapper.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.tld.mapper.MenuMapper">
 
     <sql id="field">
-        id,name,url,p_id,order_by,type
+        id,name,url,p_id,order_by,type,img
     </sql>
     <!-- 查询菜单 -->
     <select id="getMenu" resultType="com.tld.model.Menu">
@@ -42,7 +42,7 @@
     </select>
     <!-- 新增菜单 -->
     <insert id="addMenu">
-        insert into tld_menu(name,url,p_id,order_by,type) values(#{name},#{url},#{pId},#{orderBy},#{type})
+        insert into tld_menu(name,url,p_id,order_by,type,img) values(#{name},#{url},#{pId},#{orderBy},#{type},#{img})
     </insert>
     <!-- 修改菜单 -->
     <update id="updateMenu">
@@ -64,6 +64,9 @@
                 <if test="type != null and type != ''">
                     type = #{type},
                 </if>
+                <if test="img != null and img != ''">
+                    img = #{img},
+                </if>
             </trim>
         </set>
             where id = #{id}
@@ -77,11 +80,12 @@
         SELECT a.id,
                a.name,
                a.url,
+               a.img,
                a.p_id,
                c.menu
         FROM tld_menu a
-         JOIN tld_user b ON b.id = #{userId}
-         JOIN tld_role c ON b.role = c.id
+        JOIN tld_user b ON b.id = #{userId}
+        JOIN tld_role c ON b.role = c.id
         WHERE c.menu LIKE CONCAT('%', CONCAT(a.id, ','), '%')
         ORDER BY a.order_by
     </select>

+ 2 - 3
src/main/resources/mapper/WarehouseTransferMapper.xml

@@ -51,9 +51,8 @@
     <select id="getAsk" resultType="com.tld.model.AskGoods">
         SELECT
             ifnull(sum(a.num),0) as num
-        FROM
-            tld_ask_goods_vitrual a
-                join tld_material b on a.wllb_code = b.code and b.tld_id = #{materialId}
+        FROM tld_ask_goods_vitrual a
+        join tld_material b on a.wllb_code = b.code and b.tld_id = #{materialId}
         where a.storage_location_code = #{storageLocationCode}
     </select>
     <!-- 查询移库单内容 -->

+ 27 - 6
src/main/resources/mapper/WarehousingMapper.xml

@@ -228,7 +228,7 @@
             seq,
             user_id,
             storage_location_name
-        from tld_warehousing_virtual where unique_code = #{uniqueCode}
+        from tld_warehousing_virtual where unique_code = #{uniqueCode} and type = #{type}
     </select>
     <!-- 查询导出内容 -->
     <select id="export" resultType="java.util.LinkedHashMap">
@@ -351,7 +351,8 @@
             c.source_type,
             c.move_type,
             b.code as materialCode,
-            c.notice_time as noticeTime
+            c.notice_time as noticeTime,
+            c.company_number
         from tld_notice a
         join tld_notice_f c on a.notice_id = c.notice_id
         left join tld_material b on a.material_id = b.tld_id
@@ -360,8 +361,8 @@
     <!-- 半成品跟部分产成品入库存 -->
     <insert id="addInventoryNotice">
         insert into
-            tld_inventory(storage_location_code,material_id,amount,hold,amount_lock,account_sleeve,wbs,produc_date,scrq,wllb_class,produc_batch,attribute)
-            value(#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},now(),now(),#{wllbClass},#{producBatch},#{attribute});
+            tld_inventory(storage_location_code,material_id,amount,hold,amount_lock,account_sleeve,wbs,produc_date,scrq,wllb_class,produc_batch,attribute,serial,supplier_id,wllb_code,account_sleeve)
+            value(#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},now(),now(),#{wllbClass},#{producBatch},#{attribute},#{serial},#{supplierId},#{wllbCode},#{companyNumber});
         update tld_notice set warehousing_num = #{warehousingNum},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
     </insert>
     <!-- 查询库存里是否存在半成品虚拟库位 -->
@@ -370,7 +371,7 @@
     </select>
     <!-- 增加半成品/产成品虚拟库位数量 -->
     <update id="updateInventoryNotice">
-        update tld_inventory set amount = amount + #{warehousingNum} where storage_location_code = #{storageLocationCode};
+        update tld_inventory set amount = amount + #{warehousingNum} where storage_location_code = #{storageLocationCode} and material_id = #{materialId};
         update tld_notice set warehousing_num = #{warehousingNum},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
     </update>
     <!-- 半成品出库库存查询 -->
@@ -584,7 +585,7 @@
             b.name as materialName,
             a.produc_batch,
             a.capacity,
-            c.user_name as userName
+            c.user_name as userName,
             a.storage_location_code,
             a.scrq,
             a.serial,
@@ -606,4 +607,24 @@
         </trim>
         order by a.scrq desc
     </select>
+    <!-- 查询通知单虚拟库扫描数 -->
+    <select id="getSumScanNumVal" resultType="int">
+        SELECT
+            ifnull( sum( a.num ), 0 )
+        FROM
+            tld_warehousing_virtual a
+        left join tld_material b on a.wllb_code = b.code
+        WHERE a.notice_id = #{noticeId} and b.tld_id = #{materialId}
+    </select>
+    <!-- 修改报工单入库数量 -->
+    <update id="updateNotice">
+        update tld_notice set warehousing_num = #{warehousingNum} where notice_id = #{noticeId} and material_id = #{materialId}
+    </update>
+    <!-- 查询产成品是否扫描 -->
+    <select id="getScanIsNotProduct" resultType="java.util.Map">
+        select
+            (select count(*) from tld_inventory where attribute = #{attribute} and serial = #{serial} and wllb_code = #{materialCode} and produc_date = #{producBatch}) as inventoryCount,
+            (select count(*) from tld_warehousing_virtual where attribute = #{attribute} and serial = #{serial} and wllb_code = #{materialCode} and produc_date = #{producBatch}) as virtualCount
+        from dual
+    </select>
 </mapper>