chenlu
2024-11-22 068b53bcfd44dcab4f6688f6c32707208d525f12
装箱单打印功能
5个文件已修改
1个文件已添加
267 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/mm/PrintPackingList.vue 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/productStock/StorageRecordPint.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/FinishedGoodsInventoryController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedOperateLogMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/mm/PrintPackingList.vue
New file
@@ -0,0 +1,132 @@
<script setup>
import request from "@/utils/request"
import {ElDatePicker, ElMessage} from "element-plus"
import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
import {Search} from "@element-plus/icons-vue"
import {useRouter} from 'vue-router'
import {changeFilterEvent, filterChanged} from "@/hook"
import {useI18n} from 'vue-i18n'
import deepClone from "@/utils/deepClone";
import QRCode from "qrcode";
import companyInfo from "@/stores/sd/companyInfo";
import userInfo from "@/stores/userInfo"
//语言获取
const company = companyInfo()
const {t} = useI18n()
let router = useRouter()
let produceList = ref([])
let list = ref()
const details = ref([])
const user=userInfo()
const data = ref({
  printList: []
})
let props = defineProps({
  printList: null,
})
const {currentRoute} = useRouter()
const route = currentRoute.value
data.value.printList = JSON.parse(props.printList)
onMounted(() => {
  selectPrint()
    }
)
const selectPrint = () => {
  request.post(`/finishedGoodsInventory/getSelectPrint`, data.value).then((res) => {
    if (res.code == 200) {
      produceList.value = deepClone(res.data.data)
      console.log(produceList.value)
    } else {
      ElMessage.warning(res.msg)
      router.push("/login")
    }
  })
}
</script>
<template>
<div>
  <div style="width: 49%;height: 100%" v-for="(item,id) in produceList"  :key="id">
    <div  style="height: 100%;width: 100%;">
      <table>
        <thead>
        <tr>
          <td colspan="5" style="text-align: center;font-weight: bolder">
            <div>金华福喜天成玻璃有限公司</div>
          </td>
        </tr>
        <tr style="width: 100%;" v-for="(itemFlow,index) in item.detail" :key="index">
          <td colspan="5">
            <div>客户名称:&nbsp;&nbsp;&nbsp;{{itemFlow.customer_name}}</div>
            <div>项目名称:&nbsp;&nbsp;&nbsp;{{itemFlow.project}}</div>
            <div>订单号:&nbsp;&nbsp;&nbsp;{{itemFlow.order_id}} &nbsp;&nbsp;&nbsp; 箱号:&nbsp;&nbsp;&nbsp;{{itemFlow.remarks}}</div>
          </td>
        </tr>
        <tr>
          <td style="width: 170px;">编号</td>
          <td style="width: 70px;">宽</td>
          <td style="width: 70px;">高</td>
          <td style="width: 70px;">数量</td>
          <td style="width: 70px;">面积</td>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(itemDatile,index) in item.detailList" :key="index">
          <td>{{ itemDatile.building_number }}</td>
          <td>{{ itemDatile.width }}</td>
          <td>{{ itemDatile.height }}</td>
          <td>{{ itemDatile.quantity }}</td>
          <td>{{ itemDatile.area }}</td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
</template>
<style scoped>
* {
  margin: 0;
  padding: 0;
}
#contentTable{
  width: 49%;
  height: 100%;
}
#record{
  display: flex;
  flex-wrap: wrap
}
@media print {
  @page {
    size: auto;  /* auto is the initial value */
    margin: 4mm 5mm 0mm 5mm  /* this affects the margin in the printer settings */
  }
  table {
    page-break-before: always;
    page-break-inside: auto;
  }
  thead {
    display: table-header-group;
    page-break-inside: avoid;
  }
}
</style>
north-glass-erp/northglass-erp/src/views/mm/productStock/StorageRecordPint.vue
@@ -10,14 +10,16 @@
import {Search} from "@element-plus/icons-vue";
import { useI18n } from 'vue-i18n'
import footSum from "@/hook/footSum";
import {VXETable} from "vxe-table";
import PrintPackingList from "@/components/mm/PrintPackingList.vue";
import {CircleCheck, Download, Printer} from "@element-plus/icons-vue/global";
import print from "vue3-print-nb";
//语言获取
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
const userStore = useUserInfoStore()
const username = userStore.user.userName
const userid = userStore.user.userId
const dialogTableVisible = ref(false)
let produceList = ref([])
const getTableRow = (row,type) =>{
  switch (type) {
@@ -31,6 +33,15 @@
    }
  }
}
//打印
let printRow = ref({
  list: null
})
const printRecord = ref({
  id: 'record'
})
const hasDecimal=(value)=>{
  const regex=/\./ // 定义正则表达式,查找小数点
@@ -76,7 +87,6 @@
    request.post(`/finishedGoodsInventory/getSelectStorageRecordPint/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
      if(res.code==200){
        console.log(res.data)
        total.dataTotal = res.data.total.total*1
        total.pageTotal= res.data.total.pageTotal
        selectDate.value = res.data.selectDate
@@ -251,7 +261,7 @@
    if ($grid) {
      switch (code) {
        case 'cancel': {
        case 'pint': {
          const $table = xGrid.value
          //gridOptions.columns.unshift(a)
          if ($table) {
@@ -261,27 +271,8 @@
              ElMessage.warning(t('productStock.unselectedData'))
              return
            }
            let flowData = ref({
              userId:userid,
              userName:username,
              orderDetail:selectRecords
            })
            request.post("/finishedGoodsInventory/cancelFinishedGoodsInventoryStorage",flowData.value).then((res) => {
              if(res.code==200 && res.data==="true"){
                ElMessage.success(t('productStock.invalidSuccessfully'))
                router.push({path:'/main/productStock/storageRecord',query:{random:Math.random(),storageType: type.value}})
              }else if(res.data==="false1"){
                ElMessage.warning("发货单已创建")
              }else{
                ElMessage.warning(t('productStock.cancellationFailed'))
              }
            }).catch((err)=>{
              ElMessage.error(t('basicData.msg.ServerConnectionError'))
              router.push("/login")
            })
            printRow.value.list = JSON.stringify(selectRecords)
            dialogTableVisible.value = true
          }
          return;
@@ -385,6 +376,22 @@
    </vxe-grid>
<!--    装箱单打印-->
    <el-dialog
        id="sizePrintCalrd"
        v-model="dialogTableVisible"
        title="装箱单打印"
        destroy-on-close
        style="width: 75%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printRecord" :icon="Printer" circle/>
      </template>
      <print-packing-list
          id="record"
          :printList="printRow.list"
          style="width: 100%;height: 100%"/>
    </el-dialog>
  </div>
</template>
@@ -393,4 +400,11 @@
  width: 99%;
  height: 100%;
}
:deep(#sizePrintCalrd .el-dialog__body) {
  height: 90%;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap
}
</style>
north-glass-erp/src/main/java/com/example/erp/controller/mm/FinishedGoodsInventoryController.java
@@ -193,4 +193,12 @@
    public Result getSelectStorageRecordPint(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable List<String> selectDate, @RequestBody FinishedOperateLog finishedOperateLog){
        return Result.seccess(finishedGoodsInventoryService.getSelectStorageRecordPint(pageNum,pageSize,selectDate,finishedOperateLog));
    }
    /*装箱打印查询*/
    @ApiOperation("装箱打印内容查询接口")
    @SaCheckPermission("storageRecordPint.search")
    @PostMapping("/getSelectPrint")
    public Result getSelectPrint( @RequestBody Map<String, Object> object){
        return Result.seccess(finishedGoodsInventoryService.getSelectPrintSv(object));
    }
}
north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedOperateLogMapper.java
@@ -88,4 +88,7 @@
    Map<String,Integer> getSelectStorageRecordPintPageTotal(@Param("offset") Integer offset,@Param("pageSize") Integer pageSize,String startDate, String endDate,
                                                            @Param("finishedOperateLog") FinishedOperateLog finishedOperateLog);
    List<Map<String, String>> getPrimaryListLimt(String orderId, String processId, String remarks);
    List<Map<String, Object>> getDetailList(String orderId, String processId, String remarks);
}
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java
@@ -876,9 +876,23 @@
    }
    public Map<String, Object> getSelectPrintSv(Map<String, Object> object) {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果
        List<FinishedOperateLog> finishedOperateLogList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FinishedOperateLog.class);
        if (!finishedOperateLogList.isEmpty()) {
            for (FinishedOperateLog finishedOperateLog : finishedOperateLogList) {
                Map<String, Object> itemmap = new HashMap<>();
                itemmap.put("detail", finishedOperateLogMapper.getPrimaryListLimt(finishedOperateLog.getOrderId(),finishedOperateLog.getProcessId(),finishedOperateLog.getRemarks()));
                List<Map<String, Object>> detailList = finishedOperateLogMapper.getDetailList(finishedOperateLog.getOrderId(),finishedOperateLog.getProcessId(),finishedOperateLog.getRemarks());
                itemmap.put("detailList", detailList);
                list.add(itemmap);
                list.add(itemmap);
            }
        }
        map.put("data", list);
        return map;
    }
}
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml
@@ -808,7 +808,45 @@
    </select>
<select id="getPrimaryListLimt">
    select  o.order_id,
    o.customer_name,
    o.project,
    fol.remarks,
    fol.quantity
    from (select *
    from mm.finished_operate_log aa where aa.operate_type = '入库'  and aa.status!='已作废') fol
    left join sd.order_detail od on fol.order_id = od.order_id and fol.operation_number = od.order_number
    left join sd.`order` o on o.order_id=fol.order_id
    where
    o.order_id=#{orderId} and fol.process_id=#{processId} and fol.remarks=#{remarks}
    and (fol.remarks is not null and fol.remarks !="") and (fol.process_id !="" and fol.process_id is not null)
    group by fol.remarks,od.order_id,fol.process_id
    order by fol.operate_time desc
</select>
<select id="getDetailList">
    SELECT
        od.building_number,
        od.width,
        od.height,
        fol.quantity,
        ROUND(od.width * od.height * fol.quantity / 1000000, 2) AS area
    FROM
        (SELECT * FROM mm.finished_operate_log aa WHERE aa.operate_type = '入库' AND aa.STATUS != '已作废') fol
            LEFT JOIN sd.order_detail od ON fol.order_id = od.order_id
            AND fol.operation_number = od.order_number
            LEFT JOIN sd.`order` o ON o.order_id = fol.order_id
            JOIN
        (SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
         UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7
         UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10) n
    ORDER BY
        fol.operate_time DESC
        LIMIT 50
</select>
</mapper>