廖井涛
2024-08-29 ab335a89280e8bc22068c8dc42787959dfbfb466
新增物料出库打印
6个文件已修改
1个文件已添加
365 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/mm/materialOutbound/PrintSheet1.vue 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/mm/materialOutbound/PrintSheet1.vue
New file
@@ -0,0 +1,213 @@
<script setup>
import request from "@/utils/request"
import {computed, onMounted, ref} from "vue"
import PrintFoot from "@/components/sd/order/PrintFoot.vue"
import companyInfo from "@/stores/sd/companyInfo"
import deepClone from "@/utils/deepClone";
import {ElMessage} from "element-plus";
import useUserInfoStore from "@/stores/userInfo";
import {Bottom, Burger, Food} from "@element-plus/icons-vue";
const company = companyInfo()
const userStore = useUserInfoStore()
const username = userStore.user.userName
let dialogVisible = ref(false)
let props = defineProps({
  materialOutboundId:null
})
let productId=ref({
})
let createOutbound = ref({})
let createOutboundDetail = ref({})
let materialStore= ref([])
const getData = () => {
  console.log(props.materialOutboundId)
  request.get(`/MaterialInventory/printCreateOutbound/${props.materialOutboundId}`).then(res => {
    createOutbound.value=res.data.createOutbound
    createOutboundDetail.value=res.data.createOutboundDetail
    console.log(createOutbound.value)
    console.log(createOutboundDetail.value)
    materialStore.value=[]
    for (let i=0;i< createOutboundDetail.value.length;i++){
      materialStore.value[i]=(createOutboundDetail.value[i])
      materialStore.value[i].json=(JSON.parse(createOutboundDetail.value[i].json))
    }
    console.log(materialStore.value)
  })
}
onMounted(() => {
  getData()
})
const printSheet = () => {
}
defineExpose({
  printSheet
});
</script>
<template>
  <div id="sheet" @dblclick="handleDoubleClick" >
    <table style="border-style: none;" >
      <thead>
      <tr class="title-s">
        <th colspan="6">
          <h1>
            {{ company.companyName }}
          </h1>
        </th>
      </tr>
      <tr class="title-s">
        <th colspan="1" style="width: 30%"></th>
        <th colspan="4" style="width: 40%;">
          <h3 >物料出库单</h3>
        </th>
        <th colspan="1" style="width: 30%;">出库单号:<span>{{ createOutbound.material_outbound_id }}</span></th>
      </tr>
      <tr>
        <th style="text-align: left;border:none;font-weight: bold;font-size: 17px;" colspan="1">
          领料日期:<span>{{ createOutbound.material_requisition_date }}</span></th>
        <th style="text-align: left;border:none;font-weight: bold;font-size: 17px;" colspan="1">
          领料员:<span>{{ createOutbound.material_requisition_personnel }}</span></th>
        <th style="text-align: left;border:none;font-weight: bold;font-size: 17px;" colspan="2">
          领料班组:<span>{{ createOutbound.material_requisition_team }}</span></th>
        <th style="text-align: center;border:none;font-weight: bold;font-size: 17px;" colspan="2">
          销售单号:<span>{{ createOutbound.order_id }}</span></th>
      </tr>
      </thead>
      <tr style="border-style: none">
        <td colspan="6" style="border-style: none">
          <table style="border-style: none;width: 100%;height: 100%">
              <thead>
              <tr>
                <th style="width: 15%;font-weight: bold;">物料编码</th>
                <th style="width: 25%;font-weight: bold;" >物料名称</th>
                <th style="width: 15%;font-weight: bold;" >宽</th>
                <th style="width: 15%;font-weight: bold;">高</th>
                <th style="width: 15%;font-weight: bold;">数量</th>
                <th style="width: 15%;font-weight: bold;" >产地</th>
              </tr>
              </thead>
              <tr class="day-in" v-for="(items, index1) in materialStore" :key="index1">
                <td>{{items.materialCode}}</td>
                <td>{{items.json.name }}</td>
                <td>{{items.json.width}}</td>
                <td>{{items.json.height}}</td>
                <td>{{items.outboundQuantity }}</td>
                <td>{{items.producer}}</td>
              </tr>
            <tfoot style="border: 0">
            <tr class="day-in" style="border: 0;">
              <td colspan="6" style="border: 0;">
                <div style="display:flex;">
                  <div style="width: 15%">仓管员:{{ createOutbound.warehouse_manager }}</div>
                  <div style="width: 25%">制单日期:{{ createOutbound.create_time }}</div>
                  <div style="width: 15%">审核员:{{ createOutbound.reviewed }}</div>
                  <div style="width: 25%">审核日期:{{ createOutbound.reviewed_time }}</div>
                  <div style="width: 15%">打印人:{{ username }}</div>
                </div>
              </td>
            </tr>
            </tfoot>
          </table>
        </td>
      </tr>
    </table>
  </div>
</template>
<style scoped>
h1,h3{
  left:0;
  right:0;
  top:0;
  bottom:0;
  margin:auto;
}
h1{
  font-size: 1.5rem;
}
h3{
  font-size: 1.2rem;
  font-weight: bolder;
}
table{
  border-collapse: collapse;
  width: 100%;
  text-align: center;
}
tr,td,th{
  border: 1px solid black;
}
th,.no-change-row {
  white-space: nowrap;
}
.title-1{
  width: 76px;
}
.title-s,.title-s th{
  border:0
}
.hr-border{
  height: 2px;
  width: 100%;
  background-color: black;
  color: black;
}
table {
  border-collapse: collapse;
  width: 100%;
}
td > table {
  margin: 0;
  padding: 0;
}
.day-in{
  height: 30px;
}
</style>
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
@@ -12,12 +12,21 @@
import {Search} from "@element-plus/icons-vue";
import { useI18n } from 'vue-i18n'
import {toolbarButtonClickEvent} from "@/hook/mouseMove";
import PrintSheet1 from "@/components/mm/materialOutbound/PrintSheet1.vue";
import {Printer} from "@element-plus/icons-vue/global";
import PrintSheet2 from "@/components/sd/delivery/PrintSheet2.vue";
//语言获取
const { t } = useI18n()
const userStore = useUserInfoStore()
const router = useRouter()
let produceList = ref([])
let sheetIndex = ref(-1)
let rowClickIndex = ref(null)
const dialogTableVisible = ref(false)
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
@@ -183,6 +192,15 @@
    resizable: true,
    useKey: true
  },
  menuConfig: {
    body: {
      options: [
        [
          { code: 'sheet1', name: t('basicData.print'), prefixIcon: 'vxe-icon-file-txt', visible: true}
        ]
      ]
    }
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
@@ -234,6 +252,39 @@
})
const gridEvents = {
  menuClick ({ menu, row, column }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (menu.code) {
        case 'sheet1': {
          console.log(rowClickIndex.value.materialOutboundId)
          if(rowClickIndex.value===null){
            ElMessage.warning(t('searchOrder.msgList.checkOrder'))
            return
          }
          if(rowClickIndex.value.reviewedState>0){
            dialogTableVisible.value = true
            sheetIndex.value=1
          }else{
            ElMessage.warning(t('order.orderNotApproved'))
          }
          break
        }
      }
    }
  },
  cellClick({ row }){
    rowClickIndex.value = row
  }
}
const printContent = ref({
  id: 'child',
})
@@ -309,6 +360,23 @@
    </vxe-grid>
    <el-dialog
        :key="dialogKey"
        id="print"
        v-model="dialogTableVisible"
        destroy-on-close
        style="width: 75%;height:75% "
    >
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContent"   :icon="Printer" circle />
      </template>
      <print-sheet1 id="child"  v-if="sheetIndex===1" :materialOutboundId="rowClickIndex.materialOutboundId" />
    </el-dialog>
  </div>
</template>
@@ -318,4 +386,9 @@
  width: 99%;
  height: 100%;
}
@media print {
  @page {
    margin: 8mm 8mm 8mm 8mm;
  }
}
</style>
north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -149,6 +149,13 @@
        return Result.seccess(materialInventoryService.addSelectSurplusMaterialsDate(object));
    }
    @ApiOperation("物料出库打印接口")
    @SaCheckPermission("SelectIngredientsStock.search")
    @GetMapping ("/printCreateOutbound/{materialOutboundId}")
    public Result printCreateOutbound(@PathVariable String materialOutboundId)  {
        return   Result.seccess(materialInventoryService.printCreateOutbound(materialOutboundId));
    }
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -78,6 +78,8 @@
    Boolean insertMaterialOutbound(@Param("materialOutbound") MaterialOutbound materialOutbound, @Param("number") String number);
    Boolean updateMaterialOutbound(@Param("materialOutbound") MaterialOutbound materialOutbound, @Param("number") String number);
    Boolean insertReturningWarehouse(@Param("returningWarehouse") ReturningWarehouse returningWarehouse, @Param("number") String number);
    Integer getMaterialOutboundDetailMaximum(@Param("materialOutboundId") String materialOutboundId);
@@ -202,4 +204,8 @@
    Boolean updateSurplusMaterialsIntQuantity( @Param("surplusMaterials") SurplusMaterials surplusMaterials);
    Map<String,Object> getPrintCreateOutbound(String materialOutboundId);
    List<Map<String,Object>> getPrintCreateOutboundDetail(String materialOutboundId);
}
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -74,6 +74,7 @@
                }
                //删除材料出库明细的数据
                materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                materialInventoryMapper.updateMaterialOutbound(materialOutbound, materialOutboundId);
                oddNumber = materialOutboundId;
            } else {
                //获取单号
@@ -631,6 +632,13 @@
    }
    public Map<String, Object> printCreateOutbound(String materialOutboundId) {
        Map<String, Object> map = new HashMap<>();
        map.put("createOutbound", materialInventoryMapper.getPrintCreateOutbound(materialOutboundId));
        map.put("createOutboundDetail", materialInventoryMapper.getPrintCreateOutboundDetail(materialOutboundId));
        return map;
    }
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -61,6 +61,7 @@
                date(mi.create_time)>=#{startDate} and date(mi.create_time) &lt;= #{endDate} and mi.available_quantity>0
        </where>
        order by mi.id desc
        limit #{offset},#{pageSize};
    </select>
@@ -105,6 +106,7 @@
            date(ou.create_time)>=#{startDate} and date(ou.create_time) &lt;= #{endDate}
        </where>
        order by ou.id desc
        limit #{offset},#{pageSize};
    </select>
@@ -609,6 +611,17 @@
               )
    </insert>
    <insert id="updateMaterialOutbound"  >
        update mm.material_outbound
        set material_requisition_personnel=#{materialOutbound.materialRequisitionPersonnel},
            material_requisition_team=#{materialOutbound.materialRequisitionTeam},
            order_id=#{materialOutbound.orderId},
            outbound_type=#{materialOutbound.outboundType},
            warehouse_manager=#{materialOutbound.warehouseManager},
            material_requisition_date=#{materialOutbound.materialRequisitionDate}
        where material_outbound_id = #{number}
    </insert>
    <insert id="insertMaterialOutboundDetail"  useGeneratedKeys="true" >
        insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,material_name,use_id,inventory_id,inventory_organization,producer,unit,width,
                                                 height,thickness,outbound_quantity,single_piece_area,inventory_area,date_of_manufacture,remarks)
@@ -849,5 +862,49 @@
        update mm.surplus_materials set quantity=quantity+#{surplusMaterials.quantity} where id=#{surplusMaterials.id}
    </update>
    <select id="getPrintCreateOutbound" >
        select id,
               material_outbound_id,
               material_requisition_personnel,
               material_requisition_team,
               order_id,
               outbound_type,
               warehouse_manager,
               date(material_requisition_date) as material_requisition_date,
               reviewed,
               date(reviewed_time) as reviewed_time,
               reviewed_state,
               date(create_time) as create_time
        from mm.material_outbound
        where material_outbound_id = #{materialOutboundId}
    </select>
    <select id="getPrintCreateOutboundDetail" >
        select
            ou.project_no as  projectNo,
            modd.inventory_id as id,
            modd.inventory_organization as inventoryOrganization,
            modd.material_code as materialCode,
            modd.material_name as materialName,
            modd.producer,
            modd.width,
            modd.height,
            modd.thickness,
            modd.unit,
            modd.outbound_quantity as outboundQuantity,
            date(modd.date_of_manufacture) as dateOfManufacture,
            modd.single_piece_area as singlePieceArea,
            modd.inventory_area as inventoryArea,
            modd.remarks,
            ou.use_count as inventoryQuantity,
            if(mo.reviewed_state!=1,modd.outbound_quantity+ou.not_use_count,ou.not_use_count) as availableQuantity,
            ms.json,
            modd.producer
        from mm.material_outbound_detail modd left join pp.optimize_use ou on modd.use_id=ou.id
                                              left join mm.material_outbound mo on modd.material_outbound_id=mo.material_outbound_id
                                              left join mm.material_store ms on modd.material_code=ms.id
        where modd.material_outbound_id = #{materialOutboundId}
    </select>
</mapper>
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
@@ -17,6 +17,7 @@
                and m.type regexp #{materialStore.type}
            </if>
        </where>
        order by m.id desc
        limit #{offset},#{pageSize};
    </select>