Browse Source

feat:大屏展示出入库接口调整

hmc 1 year ago
parent
commit
b2bf4e652c

+ 108 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterialInventoryController.java

@@ -100,9 +100,70 @@ public class MaterialInventoryController extends BaseController {
 //        return AjaxResult.error("入库失败");
     }
 
+    /**
+     * 扫码入库
+     * /system/inventory/insertMaterialInventoryTwo 入库
+     * /system/inventory/deliveryFromStorageTwo 出库
+     */
+    @PreAuthorize("@ss.hasPermi('system:inventory:add')")
+    @Log(title = "物料库存", businessType = BusinessType.INSERT)
+    @RequestMapping(value = "/insertMaterialInventoryTwo", method = RequestMethod.POST)
+    @ApiOperation(value = "新增物料库存")
+    public AjaxResult insertMaterialInventoryTwo(@RequestBody List<MaterialInventoryVo> materialInventoryVo) {
+        //入库操作
+        return materialInventoryService.insertMaterialInventoryTwo(materialInventoryVo);
+//        String replace = materialInventoryVo.getQtCodeNumber().replace("/r", "");
+//        materialInventoryVo.setQtCodeNumber(replace);
+//        //1、禁止重复入库
+//        InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (inboundRecords != null) {
+//            return AjaxResult.success("不可以重复扫码入库");
+//        }
+//        //2、判断是第一次入库还是第二次入库这个同类商品(这是一个连表语句)
+//        MaterialInventory materialInventory
+//                = materialInventoryService.selectMaterialInventoryByMaterialCodeAndSpecifications(materialInventoryVo.getMaterialCode(), materialInventoryVo.getSpecifications());
+//        int count = 0;
+//        if (materialInventory != null) { //证明已经入库过相同的产品了---库存叠加操作
+//            Double quantityOld = materialInventory.getQuantity();
+//            Double quantity = materialInventoryVo.getQuantity();
+//            Double newQuantity =quantityOld+quantity;
+//            materialInventory.setQuantity(newQuantity);
+//            materialInventory.setUpdateTime(new Date());
+//            materialInventory.setUpdateById(SecurityUtils.getUserId());
+//            count = materialInventoryService.updateMaterialInventory(materialInventory);
+//        } else { //第一次入库走插入操作) ()
+//            MaterialInventory materialInventoryObj = new MaterialInventory();
+//            materialInventoryObj.setStockNumber(String.valueOf(new Date().getTime()));//库存编号
+//            materialInventoryObj.setWarehouseEntryNumber(UUID.randomUUID().toString());//入库单编号
+//            materialInventoryObj.setMaterialCode(materialInventoryVo.getMaterialCode());//物料编号
+//            materialInventoryObj.setQuantity(materialInventoryVo.getQuantity());//数量
+//            materialInventoryObj.setCreateById(SecurityUtils.getUserId());
+//            materialInventoryObj.setCreateTime(new Date());
+//            count = materialInventoryService.insertMaterialInventory(materialInventoryObj);
+//        }
+//        if (count > 0) {
+//            InboundRecords inboundRecords1 = new InboundRecords();
+//            inboundRecords1.setInboundTime(new Date());//入库时间
+//            //物料名称需要根据物料编码查询下
+//            Materiel materiel = materielMapper.selectMaterielByMaterielCode(materialInventoryVo.getMaterialCode());
+//            inboundRecords1.setInboundAterialsName(materiel.getMaterielName());//物料名称
+//            inboundRecords1.setSpecifications(materialInventoryVo.getSpecifications());//规格代号
+//            inboundRecords1.setInboundUnit(materialInventoryVo.getInboundUnit());//单位
+//            inboundRecords1.setInboundQuantity(materialInventoryVo.getQuantity().toString());//入库数量
+//            inboundRecords1.setInboundLeader(SecurityUtils.getUsername());//仓管员
+//            inboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+//            inboundRecords1.setCreateTime(new Date());//创建时间
+//            inboundRecords1.setQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//            inboundRecordsMapper.insertInboundRecords(inboundRecords1); //插入入库日志信息
+//            return AjaxResult.success("入库成功");
+//        }
+//        return AjaxResult.error("入库失败");
+    }
+
 
     /**
      * 扫码出库
+     * /system/inventory/deliveryFromStorageTwo
      */
     @PreAuthorize("@ss.hasPermi('system:inventory:add')")
     @Log(title = "物料库存", businessType = BusinessType.INSERT)
@@ -151,6 +212,53 @@ public class MaterialInventoryController extends BaseController {
     }
 
 
+    @PreAuthorize("@ss.hasPermi('system:inventory:add')")
+    @Log(title = "物料库存", businessType = BusinessType.INSERT)
+    @RequestMapping(value = "/deliveryFromStorageTwo",method = RequestMethod.POST)
+    @ApiOperation(value = "扫码出库")
+    public AjaxResult deliveryFromStorageTwo(@RequestBody List<MaterialInventoryVo> materialInventoryVo) {
+        //入库操作
+        return materialInventoryService.outMaterialInventoryTwo(materialInventoryVo);
+//        //1、禁止重复入库
+//        InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (inboundRecords == null) {
+//            return AjaxResult.success("此货品还没有入库,不能出库");
+//        }
+//        //2、是否重复入库
+//        OutboundRecords outboundRecords = outboundRecordsMapper.selectOutboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (outboundRecords != null) {
+//            return AjaxResult.success("此货品不能重复出库");
+//        }
+//        //3、根据物料编码跟规则查询库存信息
+//        MaterialInventory materialInventory
+//                = materialInventoryService.selectMaterialInventoryByMaterialCodeAndSpecifications(materialInventoryVo.getMaterialCode(), materialInventoryVo.getSpecifications());
+//        //4、出库多少减去这个数量
+//        Double quantityOld = materialInventory.getQuantity();
+//        Double quantity = materialInventoryVo.getQuantity();
+//        Double newQuantity =quantityOld-quantity;
+//        materialInventory.setQuantity(newQuantity);
+//        int count = materialInventoryService.updateMaterialInventory(materialInventory);
+//        if (count > 0) {
+//            OutboundRecords outboundRecords1 = new OutboundRecords();
+//            outboundRecords1.setOutboundTime(new Date());//出库时间
+//            //物料名称需要根据物料编码查询下
+//            Materiel materiel = materielMapper.selectMaterielByMaterielCode(materialInventoryVo.getMaterialCode());
+//            outboundRecords1.setQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//            outboundRecords1.setOutboundAterialsName(materiel.getMaterielName());//物料名称
+//            outboundRecords1.setOutboundNo(UUID.randomUUID().toString());//出库编号
+//            outboundRecords1.setSpecifications(materialInventoryVo.getSpecifications());//规格代号
+//            outboundRecords1.setOutboundUnit(materialInventoryVo.getInboundUnit());//单位
+//            outboundRecords1.setOutboundQuantity(materialInventoryVo.getQuantity().toString());//出库数量
+//            outboundRecords1.setOutboundLeader(SecurityUtils.getUsername());//仓管员
+//            outboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+//            outboundRecords1.setCreateTime(new Date());//创建时间
+//            outboundRecordsMapper.insertOutboundRecords(outboundRecords1); //插出库库日志信息
+//            return AjaxResult.success("出库成功");
+//        }
+//        return AjaxResult.error("出库失败");
+    }
+
+
 
     /**
      * 查询物料库存列表

+ 16 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterialInventoryService.java

@@ -38,6 +38,14 @@ public interface IMaterialInventoryService
      */
     public AjaxResult insertMaterialInventory(MaterialInventoryVo materialInventoryVo);
 
+    /**
+     * 入库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    public AjaxResult insertMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo);
+
 
     /**
      * 出库
@@ -46,6 +54,14 @@ public interface IMaterialInventoryService
      */
     public AjaxResult outMaterialInventory(MaterialInventoryVo materialInventoryVo);
 
+    /**
+     * 出库
+     * @param materialInventoryVo
+     * @return
+     */
+    public AjaxResult outMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo);
+
+
     /**
      * 修改物料库存
      * 

+ 148 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterialInventoryServiceImpl.java

@@ -15,6 +15,7 @@ import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 import com.zkqy.business.mapper.MaterialInventoryMapper;
 import com.zkqy.business.domain.MaterialInventory;
@@ -41,6 +42,7 @@ public class MaterialInventoryServiceImpl implements IMaterialInventoryService
 
     @Autowired
     private MaterielMapper materielMapper;
+
     /**
      * 入库
      *
@@ -223,6 +225,152 @@ public class MaterialInventoryServiceImpl implements IMaterialInventoryService
     }
 
 
+
+    /**
+     * 入库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult insertMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo)
+    {
+        try {
+            materialInventoryVo.forEach(item->{
+                //创建时间
+                item.setCreateTime(DateUtils.getNowDate());
+                //1、如果有证明当前这个批次的码已经被扫过了
+                InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(item.getQtCodeNumber());
+                if (inboundRecords == null) {
+                //2、判断是第一次入库还是第二次入库这个同类商品(这是一个连表语句)(同一个批次查询)
+                InboundRecords inboundRecords1=new InboundRecords();
+                inboundRecords1.setLotNumber(item.getLotNumber());
+                inboundRecords1.setMaterielId(item.getMaterialId());
+                List<InboundRecords> inboundRecords2 = inboundRecordsMapper.selectInboundRecordsList(inboundRecords1);
+                //3、判断是走新增还是修改
+                int count = 0;
+                if(inboundRecords2.size()>0){
+                    //已经入过库存了,绝对会有这个信息
+                    MaterialInventory materialInventory=new MaterialInventory();
+                    materialInventory.setMaterialId(item.getMaterialId());
+                    List<MaterialInventory> materialInventories = materialInventoryMapper.selectMaterialInventoryList(materialInventory);
+                    if(materialInventories.size()>0){
+                        //没更新的物料信息
+                        MaterialInventory oldMaterialInventory   = materialInventories.get(0);
+                        //更新物料信息数量
+                        oldMaterialInventory.setQuantity(oldMaterialInventory.getQuantity()+item.getQuantity());
+                        //执行更新操作
+                        count = materialInventoryMapper.updateMaterialInventory(oldMaterialInventory);
+                    }
+                    //没有入过库走新增操作
+                }else {
+                    MaterialInventory materialInventoryObj = new MaterialInventory();
+                    materialInventoryObj.setStockNumber(String.valueOf(new Date().getTime()));//库存编号
+                    materialInventoryObj.setWarehouseEntryNumber(UUID.randomUUID().toString());//入库单编号
+                    materialInventoryObj.setMaterialCode(item.getMaterialCode());//物料编号
+                    materialInventoryObj.setQuantity(item.getQuantity());//数量
+                    materialInventoryObj.setCreateById(SecurityUtils.getUserId());
+                    materialInventoryObj.setLotNumber(item.getLotNumber());//批号
+                    materialInventoryObj.setMaterialId(item.getMaterialId());//物料id
+                    materialInventoryObj.setCreateTime(new Date());
+                    count = materialInventoryMapper.insertMaterialInventory(materialInventoryObj);
+                }
+                if(count>0){
+                    InboundRecords inboundRecords3 = new InboundRecords();
+                    inboundRecords3.setInboundTime(new Date());//入库时间
+                    //物料名称需要根据物料编码查询下
+                    Materiel materiel = materielMapper.selectMaterielById(Long.valueOf(item.getMaterialId()));
+                    inboundRecords3.setInboundAterialsName(materiel.getMaterielName());//物料名称
+                    inboundRecords3.setSpecifications(item.getSpecifications());//规格代号
+                    inboundRecords3.setInboundUnit(item.getInboundUnit());//单位
+                    inboundRecords3.setInboundQuantity(item.getQuantity().toString());//入库数量
+                    inboundRecords3.setInboundLeader(SecurityUtils.getUsername());//仓管员
+                    inboundRecords3.setCreateById(SecurityUtils.getUserId());//创建人
+                    inboundRecords3.setCreateTime(new Date());//创建时间
+                    inboundRecords3.setLotNumber(item.getLotNumber());//批号
+                    inboundRecords3.setMaterielId(item.getMaterialId());//母粒id
+                    inboundRecords3.setQtCodeNumber(item.getQtCodeNumber());//二维码唯一编码
+                    inboundRecordsMapper.insertInboundRecords(inboundRecords3); //插入入库日志信息
+                }
+                }
+            });
+        } catch (Exception e) {
+            return  AjaxResult.error("入库失败");
+        }
+        return  AjaxResult.success("入库成功");
+    }
+
+    /**
+     * 出库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult outMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo)
+    {
+        try {
+            materialInventoryVo.forEach(item->{
+                item.setCreateTime(DateUtils.getNowDate());
+                //1、没有对应的入库记录
+//                InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(item.getQtCodeNumber());
+//                if (inboundRecords == null) {
+//                    return AjaxResult.error("此货品还没有入库,不能出库");
+//                }
+                //2、二维码是否重复使用
+    //          OutboundRecords outboundRecords = outboundRecordsMapper.selectOutboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+    //          if (outboundRecords != null) {
+    //                return"此货品不能重复出库";
+    //          }
+                //3、根据物料编码跟规则查询库存信息
+                MaterialInventory materialInventory=new MaterialInventory();
+                materialInventory.setMaterialId(item.getMaterialId());
+                List<MaterialInventory> materialInventories = materialInventoryMapper.selectMaterialInventoryList(materialInventory);
+                if(materialInventories.size()>0){
+                    Double oldQuantity = materialInventories.get(0).getQuantity();
+//                    if(item.getQuantity()>oldQuantity){
+//                        return AjaxResult.error("库存不足"+item.getQuantity()+"个");
+//                    }
+                    Double outboundQuantity = item.getQuantity();
+                    //出库后剩余数量
+                    Double newQuantity =oldQuantity-outboundQuantity;
+                    //更新数量
+                    MaterialInventory doubleMaterialInventory = new MaterialInventory();
+                    doubleMaterialInventory.setQuantity(newQuantity);
+                    doubleMaterialInventory.setMaterialId(item.getMaterialId());
+                    //执行sql语句
+                    int count = materialInventoryMapper.updateMaterialInventoryByMaterialId(doubleMaterialInventory);
+                    //代表出库成功
+                    if(count>0){
+                        OutboundRecords outboundRecords1 = new OutboundRecords();
+                        outboundRecords1.setOutboundTime(new Date());//出库时间
+                        //物料名称需要根据物料编码查询下
+                        Materiel materiel = materielMapper.selectMaterielById(Long.valueOf(item.getMaterialId()));
+                        outboundRecords1.setQtCodeNumber(item.getQtCodeNumber());
+                        outboundRecords1.setOutboundAterialsName(materiel.getMaterielName());//物料名称
+                        outboundRecords1.setOutboundNo(UUID.randomUUID().toString());//出库编号
+                        outboundRecords1.setSpecifications(item.getSpecifications());//规格代号
+                        outboundRecords1.setOutboundUnit(item.getInboundUnit());//单位
+                        outboundRecords1.setOutboundQuantity(item.getQuantity().toString());//出库数量
+                        outboundRecords1.setOutboundLeader(SecurityUtils.getUsername());//仓管员
+                        outboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+                        outboundRecords1.setCreateTime(new Date());//创建时间
+                        outboundRecords1.setLotNumber(item.getLotNumber());//批号
+                        outboundRecords1.setQtCodeNumber(item.getQtCodeNumber());//二维码
+                        outboundRecords1.setMaterielId(item.getMaterialId());//母粒iD
+                        outboundRecordsMapper.insertOutboundRecords(outboundRecords1); //插出库库日志信息
+                    }
+                }
+
+            });
+        } catch (Exception e) {
+//            throw new RuntimeException(e);
+            return AjaxResult.error("出库失败");
+        }
+        return AjaxResult.success("出库成功");
+    }
     /**
      * 查询物料库存
      * 

+ 1 - 1
zkqy-system/src/main/java/com/zkqy/system/mapper/SysLogininforMapper.java

@@ -28,7 +28,7 @@ public interface SysLogininforMapper
      */
     public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor);
 
-    public List<Map> getLoginInformationStatistics(@Param("tenantId")String tenantId,@Param("whichApplication") String whichApplication);
+    public List<Map> getLoginInformationStatistics(@Param("tenantId") String tenantId,@Param("whichApplication") String whichApplication);
 
 
     /**

+ 47 - 0
zkqy-ui/src/router/index.js

@@ -55,6 +55,53 @@ export const constantRoutes = [
     ]
   },
   {
+    path: '/redirect',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: '/redirect/:path(.*)',
+        component: () => import('@/views/redirect')
+      }
+    ]
+   },
+   {
+      path: '/planTable/show/northWorkshop',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/northWorkshop')
+      },
+      hidden: true
+    },
+  {
+    path: '/planTable/show/southWorkshop',
+    component: () => {
+      return import('@/views/orderMange/planTable/show/southWorkshop')
+    },
+    hidden: true
+  },
+    {
+      path: '/planTable/show/fankuang',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/fankuang')
+      },
+      hidden: true
+    },
+    {
+      path: '/planTable/show/fangsi',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/fangsi')
+      },
+      hidden: true
+    },
+    {
+      path: '/planTable/show/luotong',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/luotong')
+      },
+      hidden: true
+    },
+
+   {
     path: '/tableMange',
     component: Layout,
     hidden: true,

+ 3 - 4
zkqy-ui/src/views/orderMange/planTable/index.vue

@@ -28,11 +28,10 @@
           <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
             <template slot-scope="scope">
               <div v-if="scope.row.listOfPendingProduction">
-                <div v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
-                  {{ item }}
-                  <span v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1">,</span>
+                <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
+                  {{ item }},
                   <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
-                </div>
+                </span>
               </div>
             </template>
           </el-table-column>