guoyujie
10 小时以前 62a2e5583931e439b5914e39801173074e83e9ac
提交 订单其他金额列和金额重置方法业务调整
11个文件已修改
265 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue 171 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/ar.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/en.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/kr.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/ru.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/zh.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/sd/DeliveryOtherMoney.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderOtherMoney.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/sd/order/OrderOtherMoney.vue
@@ -1,10 +1,11 @@
<script setup>
import {computed, onMounted, reactive, ref, watch} from "vue"
import {computed, onMounted, reactive, ref, watch,h} from "vue"
import {filterChanged} from "@/hook"
import {useI18n} from "vue-i18n"
import {ElMessage, ElMessageBox,} from "element-plus"
import {ElInput, ElMessage, ElMessageBox,} from "element-plus"
import request from "@/utils/request"
import {useRouter,useRoute} from "vue-router"
const emits = defineEmits(['addNewCustomColumn','deleteCustomColumn'])
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
@@ -72,13 +73,10 @@
      {'code': 'add', 'name': t('basicData.insert'),status: 'primary'},
      {'code': 'delete', 'name': t('basicData.delete'),status: 'primary'}
    ],
    slots: {
      tools: 'toolbar_buttons'
    },
    // import: false,
    // export: true,
    // print: true,
    // zoom: true,
    // custom: true
  }
  ,
  //table body实际数据
@@ -119,7 +117,7 @@
            ElMessage.warning(t('components.pleaseClickToSelectARowFirst'))
            return
          }
          deleteColum(rowClickIndex.value.id)
          deleteColum(rowClickIndex.value)
          rowClickIndex.value = null
          break
        }
@@ -138,22 +136,25 @@
  })
  return count.toFixed(2)==='NaN' ? null : parseFloat(count.toFixed(2))
}
let radio1 = ref(1)
//用于接收父组件参数
let prop = defineProps({
  otherMoney:{}
})
onMounted(()=>{
  console.log(prop.otherMoney)
  if(Object.keys(prop.otherMoney).length === 0){
    return
  }
  xGrid.value.reloadData(prop.otherMoney.filter(item => item.column.indexOf('M')>-1))
  xGrid.value.reloadData(prop.otherMoney.filter(item => item.column===null || item.column.startsWith('M')))
})
watch(prop,(newVal)=>{
  console.log(prop.otherMoney)
  if(Object.keys(prop.otherMoney).length === 0){
    return
  }
  xGrid.value.reloadData(prop.otherMoney.filter(item => item.column.indexOf('M')>-1))
  xGrid.value.reloadData(prop.otherMoney.filter(item => item.column===null || item.column.startsWith('M')))
})
const countAmount = (row) => {
@@ -174,32 +175,97 @@
defineExpose({
  validate
})
const state = reactive({
  alias: null,
  price: null,
  quantity: null,
})
const vNode = () => {
  return h('div', {}, [
    h('div', { style: 'margin-bottom: 10px;' }, [
      h('div', {}, '列名'),
      h(ElInput, {
        modelValue: state.alias,
        'onUpdate:modelValue': ($event) => {
          state.alias = $event;
        },
      }),
    ]),
    h('div', {}, [
      h('div', {}, '单价'),
      h(ElInput, {
        modelValue: state.price,
        'onUpdate:modelValue': ($event) => {
          state.price = $event;
        },
      }),
    ]),
    h('div', {}, [
      h('div', {}, '数量'),
      h(ElInput, {
        modelValue: state.quantity,
        'onUpdate:modelValue': ($event) => {
          state.quantity = $event;
        },
      }),
    ]),
  ]);
}
const addColumn = () => {
  ElMessageBox.prompt( t('components.addColumnNames')+':', {
    confirmButtonText: t('basicData.insert'),
    cancelButtonText: t('basicData.cancelButtonText'),
    inputPattern:/^.{1,20}$/,
    inputErrorMessage: t('components.message'),
  })
    .then(({ value }) => {
      request.post('/basicOtherMoney/save',{alias:value}).then(res=>{
        if (res.code==='200' && res.data!==false){
          ElMessage.success(t('basicData.msg.saveSuccess'))
          setTimeout(()=>{
            window.location.reload()
          },1500)
  if(radio1.value===1){
    ElMessageBox({
      title: t('components.addColumnNames'),
      message: () => vNode(),
      // 不允许点击遮罩层关闭
      'close-on-click-modal': false,
    }).then(() => {
      if(!(/^.{1,20}$/.test(state.alias))){
        ElMessage.error(t('components.message'))
        return
      }
      if(!(/^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/.test(state.price))){
        ElMessage.warning(t('basicData.msg.range99999Dec2'))
        return
      }
      if(!(/^[1-9]\d*$/.test(state.quantity))){
        ElMessage.warning(t('basicData.msg.greater0'))
        return
      }
        }else{
          ElMessage.error(t('basicData.msg.saveFail'))
        }
      })
      emits('addNewCustomColumn', state)
    })
  }else{
    ElMessageBox.prompt( t('components.addColumnNames')+':', {
      confirmButtonText: t('basicData.insert'),
      cancelButtonText: t('basicData.cancelButtonText'),
      inputPattern:/^.{1,20}$/,
      inputErrorMessage: t('components.message'),
    })
        .then(({ value }) => {
          request.post('/basicOtherMoney/save',{alias:value.trim()}).then(res=>{
            if (res.code==='200' && res.data!==false){
              ElMessage.success(t('basicData.msg.saveSuccess'))
              setTimeout(()=>{
                window.location.reload()
              },1500)
            }else{
              ElMessage.error(t('basicData.msg.saveFail'))
            }
          })
        })
  }
}
const deleteColum = (id) => {
const deleteColum = (row) => {
  ElMessageBox.confirm(
      t('searchOrder.deleteConfirm'),
      'Warning',
@@ -210,16 +276,26 @@
      }
  )
      .then(() => {
        request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{
          if (res.code==='200' && res.data!==false){
            ElMessage.success(t('basicData.msg.deleteSuccess'))
            setTimeout(()=>{
              window.location.reload()
            },1500)
          }else{
            ElMessage.error(t('basicData.msg.deleteFail'))
        if(radio1.value===1){
          if(row.deliveryState ===1 && !row.column){
            ElMessage.warning('已创建发货单,无法删除')
            return
          }
        })
          emits('deleteCustomColumn', row.id)
        }else{
          request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{
            if (res.code==='200' && res.data!==false){
              ElMessage.success(t('basicData.msg.deleteSuccess'))
              setTimeout(()=>{
                window.location.reload()
              },1500)
            }else{
              ElMessage.error(t('basicData.msg.deleteFail'))
            }
          })
        }
      })
}
@@ -239,6 +315,25 @@
      <template #default="{ row }">
        <span>{{ countAmount(row) }} </span>
      </template>
      <template #toolbar_buttons>
        <el-select v-model="radio1" placeholder="" style="width: 240px">
          <el-option
              :label="$t('components.customColumn')"
              :value="1"
          />
          <el-option
              :label="$t('components.systemColumn')"
              :value="2"
          />
       </el-select>
<!--        <el-radio-group >-->
<!--          <el-radio :value="1">{{$t('components.customColumn')}}</el-radio>-->
<!--          <el-radio :label="2">{{}}</el-radio>-->
<!--        </el-radio-group>-->
      </template>
    </vxe-grid>
  </div>
north-glass-erp/northglass-erp/src/lang/ar.js
@@ -1327,6 +1327,9 @@
    components:{
        addNewSignature :'أضف اسم جديد',
        addColumnNames :'أضف اسم العمود',
        customColumn:'自定义列',
        systemColumn:'系统列',
        addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)',
        message :'الرجاء إدخال الأحرف ضمن 20 حرفاً، لايمكن ان يكون فارغاً',
        activeName :'قائمة الأسماء',
        orderHeader :'رأس الطلب',
north-glass-erp/northglass-erp/src/lang/en.js
@@ -1327,6 +1327,9 @@
    components:{
        addNewSignature :'Add label name',
        addColumnNames :'New column name',
        customColumn:'自定义列',
        systemColumn:'系统列',
        addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)',
        message :'Please enter a non-empty character with a maximum of 20 characters',
        activeName :'Tag list',
        orderHeader :'Order header',
north-glass-erp/northglass-erp/src/lang/kr.js
@@ -1327,6 +1327,9 @@
    components:{
        addNewSignature :'라벨명 추가',
        addColumnNames :'열 이름 추가',
        customColumn:'自定义列',
        systemColumn:'系统列',
        addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)',
        message :'공백이 아닌 20자 이내의 문자를 입력하세요',
        activeName :'라벨 목록',
        orderHeader :'주문 상단',
north-glass-erp/northglass-erp/src/lang/ru.js
@@ -1327,6 +1327,9 @@
    components:{
        addNewSignature :'Добавить имя метки',
        addColumnNames :'Добавление в перечень',
        customColumn:'自定义列',
        systemColumn:'系统列',
        addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)',
        message :'Введите не пустые символы в пределах 20 символов.',
        activeName :'Список меток',
        orderHeader :'Заголовок заказа',
north-glass-erp/northglass-erp/src/lang/zh.js
@@ -1328,6 +1328,9 @@
    components:{
        addNewSignature :'新增标签名',
        addColumnNames :'新增列名',
        customColumn:'自定义列',
        systemColumn:'系统列',
        addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)',
        message :'请输入20个字符以内的且不为空的字符',
        activeName :'标签列表',
        orderHeader :'订单表头',
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -1855,6 +1855,37 @@
  processAttributeVisible.value = false
}
const addNewCustomColumn = (column) => {
  //先对数组里的column属性进行去重,去除S开头的属性
  const uniqueColumns = Array.from(new Set(otherMoney.value.filter(item => !(item.column && item.column.startsWith('S')))));
  const isDuplicate = uniqueColumns.some(item => {
    // 确保item存在且有alias属性
    if (!item || typeof item.alias !== 'string') {
      return false;
    }
    // 比较时忽略大小写和前后空格
    return item.alias.trim().toLowerCase() === column.alias.trim();
  });
  if(isDuplicate){
    ElMessage.error('列名存在')
    return
  }
  otherMoney.value.push({
    "id": null,
    "column": null,
    "alias": column.alias.trim(),
    "quantity": column.quantity,
    "price": column.price,
    "state": true
  })
}
const deleteCustomColumn = (id) => {
  otherMoney.value= Array.from(new Set(otherMoney.value.filter(item => !(!item.column && item.id===id))))
}
</script>
<template>
@@ -2099,6 +2130,8 @@
      <order-other-money
          ref="refOtherMoney"
          :otherMoney="otherMoney"
          @addNewCustomColumn = "addNewCustomColumn"
          @deleteCustomColumn = 'deleteCustomColumn'
          style="width: 100%;height: 100%" />
    </el-dialog>
<!--异形导入-->
@@ -2146,7 +2179,9 @@
               :close-on-click-modal="false"
               :title="$t('order.orderTransfer')"
               destroy-on-close width="500">
      <order-number-report-transfer :transferData="transferData" @orderNumberTransfer="orderNumberTransfer"/>
      <order-number-report-transfer
          :transferData="transferData"
          @orderNumberTransfer="orderNumberTransfer"/>
    </el-dialog>
    <el-dialog id="loadDWG"
north-glass-erp/src/main/java/com/example/erp/entity/sd/DeliveryOtherMoney.java
@@ -17,7 +17,7 @@
    private Double quantity;
    private Double price;
    private Double money;
    @TableField(select = false,exist= false)
    private String alias;
    private Integer deliveryState;
    private LocalDateTime createTime;
}
north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderOtherMoney.java
@@ -17,7 +17,7 @@
    private Double quantity;
    private Double price;
    private Double money;
    @TableField(select = false,exist= false)
    private String alias;
    private Integer deliveryState;
    private LocalDateTime createTime;
}
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -83,9 +83,8 @@
        List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("detail")), OrderDetail.class);
        List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("otherMoney")), OrderOtherMoney.class);
        if(orderOtherMoneyList != null ){
            orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList());
            orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn()==null || o.getColumn().indexOf("M")==0).collect(Collectors.toList());
        }
        boolean saveState = true;
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
@@ -265,7 +264,11 @@
        //先把其他金额副表的金额与数量置0
        if(orderOtherMoneyList!=null){
            orderOtherMoneyList.forEach(orderOtherMoney -> {
                orderOtherMoney.setQuantity(0.0);
                if(orderOtherMoney.getColumn()!=null){
                    orderOtherMoney.setQuantity(0.0);
                }else{
                    orderOtherMoney.setMoney(orderOtherMoney.getPrice()*orderOtherMoney.getQuantity());
                }
            });
        }
@@ -519,11 +522,15 @@
        List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("otherMoney")), OrderOtherMoney.class);
        if(orderOtherMoneyList != null ){
            orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList());
            orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn()==null || o.getColumn().indexOf("M")==0).collect(Collectors.toList());
        }
        if(orderOtherMoneyList!=null){
            orderOtherMoneyList.forEach(orderOtherMoney -> {
                orderOtherMoney.setQuantity(0.0);
                if(orderOtherMoney.getColumn()!=null){
                    orderOtherMoney.setQuantity(0.0);
                }else{
                    orderOtherMoney.setMoney(orderOtherMoney.getPrice()*orderOtherMoney.getQuantity());
                }
            });
        }
north-glass-erp/src/main/resources/mapper/sd/OrderOtherMoneyMapper.xml
@@ -12,16 +12,33 @@
            a.money,
            a.create_time,
            b.alias,
            b.id
            b.id,
            a.delivery_state
        from basic_other_money as b
        left join  order_other_money as a
        on a.`column` = b.`column` and a.order_id = #{orderId}
        where b.`column` like 'M%' and b.state=1
        UNION ALL
-- 查询 order_other_money 表中 column 为空的记录
        SELECT
            a.order_id,
            null AS `column`,
            a.quantity,
            a.price,
            a.money,
            a.create_time,
            a.alias, -- 使用 order_other_money 表中的别名
            a.id,
            a.delivery_state
        FROM order_other_money AS a
        WHERE a.order_id = #{orderId}
          AND (a.`column` IS NULL OR a.`column` = '')
    </select>
    <select id="selectGrossAmount">
        select ifnull(sum(money),0) from order_other_money where order_id = #{orderId}
    </select>