Browse Source

add 修复bug,调整商品菜单,采购优化

xuhaifeng 2 months ago
parent
commit
79cfcb8ef1
32 changed files with 838 additions and 56 deletions
  1. BIN
      D:/ruoyi/uploadPath/download/046b8ef3-b052-4a75-99af-205d73ff469e_工厂每日报表统计.xlsx
  2. BIN
      D:/ruoyi/uploadPath/download/2703fe89-ac5e-4e74-aabf-e712aa9017f3_工厂每日报表统计.xlsx
  3. BIN
      D:/ruoyi/uploadPath/download/ce1d4582-f5ea-4224-ba45-a8ba979d3b6b_工厂每日报表统计.xlsx
  4. 2 2
      admin-ui/.env.development
  5. 0 1
      admin-ui/src/store/modules/user.js
  6. 2 3
      admin-ui/src/views/app/delivery/index.vue
  7. 19 6
      admin-ui/src/views/goods/commonGoods/index.vue
  8. 8 1
      admin-ui/src/views/goods/goodsComment/index.vue
  9. 11 6
      admin-ui/src/views/systemSet/purchaseGoods/index.vue
  10. 747 0
      admin-ui/src/views/systemSet/purchaseGoods/platform.vue
  11. 0 0
      log.path_IS_UNDEFINED/sys-error.log
  12. 0 0
      log.path_IS_UNDEFINED/sys-info.log
  13. 0 0
      log.path_IS_UNDEFINED/sys-user.log
  14. 6 0
      yiqi-common/src/main/java/com/yiqi/core/domain/vo/GoodsSkuQueryVO.java
  15. 0 1
      yiqi-common/src/main/java/com/yiqi/system/domain/SysNotice.java
  16. 10 1
      yiqi-core/src/main/java/com/yiqi/core/service/impl/GoodsInfoServiceImpl.java
  17. 0 2
      yiqi-core/src/main/java/com/yiqi/core/service/impl/GoodsSkuServiceImpl.java
  18. 1 2
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderPurchaseGoodsServiceImpl.java
  19. 1 1
      yiqi-core/src/main/resources/mapper/core/ClothColorMapper.xml
  20. 1 1
      yiqi-core/src/main/resources/mapper/core/ClothCustomItemMapper.xml
  21. 1 1
      yiqi-core/src/main/resources/mapper/core/ClothFlawTopMapper.xml
  22. 1 1
      yiqi-core/src/main/resources/mapper/core/ClothFlawTypeMapper.xml
  23. 1 1
      yiqi-core/src/main/resources/mapper/core/ClothItemMapper.xml
  24. 2 2
      yiqi-core/src/main/resources/mapper/core/ClothPriceMapper.xml
  25. 1 1
      yiqi-core/src/main/resources/mapper/core/GoodsInfoMapper.xml
  26. 8 9
      yiqi-core/src/main/resources/mapper/core/GoodsSkuMapper.xml
  27. 5 5
      yiqi-core/src/main/resources/mapper/order/OrderRechargeMapper.xml
  28. 2 2
      yiqi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
  29. 3 3
      yiqi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  30. 4 0
      yiqi-system/src/main/java/com/yiqi/system/service/impl/SysOrgServiceImpl.java
  31. 1 3
      yiqi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
  32. 1 1
      yiqi-system/src/main/resources/mapper/system/SysStoreAreaMapper.xml

BIN
D:/ruoyi/uploadPath/download/046b8ef3-b052-4a75-99af-205d73ff469e_工厂每日报表统计.xlsx


BIN
D:/ruoyi/uploadPath/download/2703fe89-ac5e-4e74-aabf-e712aa9017f3_工厂每日报表统计.xlsx


BIN
D:/ruoyi/uploadPath/download/ce1d4582-f5ea-4224-ba45-a8ba979d3b6b_工厂每日报表统计.xlsx


+ 2 - 2
admin-ui/.env.development

@@ -7,8 +7,8 @@ ENV = 'development'
 
 VUE_APP_BASE_API_HOST = 'http://127.0.0.1:9801'
 VUE_APP_BASE_API = 'http://127.0.0.1:9801'
-# VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
-# VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
+#VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
+#VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
 # VUE_APP_BASE_API_HOST = 'http://192.168.98.9:9801'
 # VUE_APP_BASE_API = 'http://192.168.98.9:9801/'
 

+ 0 - 1
admin-ui/src/store/modules/user.js

@@ -53,7 +53,6 @@ const user = {
         getInfo().then(res => {
           console.log('aasss', res.user)
           const user = res.user
-          console.log('user', user)
           setUserInfo(user)
           const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
           if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组

+ 2 - 3
admin-ui/src/views/app/delivery/index.vue

@@ -249,9 +249,9 @@
       title="接单记录"
       :visible.sync="openDetail"
       width="900px"
-      :before-close="handleDetailClose"
+      :before-close="handleDetailClose" append-to-body
     >
-      <div class="record-list" v-loading="loading">
+      <div class="record-list" >
         <el-table
           :data="recordDetailList"
           border
@@ -673,7 +673,6 @@ export default {
           } else {
               this.queryDetailParams.appUserId = this.appUserId
           }
-          console.log(this.appUserId)
           getDeliveryOrderRecordList(this.queryDetailParams).then((response) => {
               this.recordDetailList = response.rows
               this.recordTotal = response.total

+ 19 - 6
admin-ui/src/views/goods/commonGoods/index.vue

@@ -1,5 +1,8 @@
 <template>
   <div class="app-container">
+    <el-tabs v-model="goodsType" @tab-click="onChangeGoodsType">
+      <el-tab-pane v-for="dict in dict.type.goods_type" :label="dict.label" :name="dict.value"></el-tab-pane>
+    </el-tabs>
     <!-- 查询 -->
     <el-card class="search-card" shadow="never">
       <el-form :model="queryParams" ref="queryForm" @submit.native.prevent :inline="true" v-show="showSearch" label-width="68px">
@@ -193,7 +196,7 @@
             <!-- 多规格设置 -->
             <template v-if="form.skuType === 1">
               <!-- 规格项设置 -->
-              <div class="spec-group" v-for="(spec, index) in form.specList" :key="index">
+              <div class="spec-group" v-for="(spec, index) in form.specList" :key="index" v-if="form.id==null">
                 <el-row :gutter="10">
                   <el-col :span="8">
                     <el-form-item :label="'规格项' + (index + 1)">
@@ -220,7 +223,7 @@
                 </el-row>
               </div>
 
-              <el-button type="primary" plain @click="addSpec">添加规格项</el-button>
+              <el-button type="primary" plain @click="addSpec" v-if="form.id==null">添加规格项</el-button>
 
               <!-- 规格组合列表 -->
               <el-table :data="form.skuList" border style="margin-top: 20px">
@@ -229,6 +232,11 @@
                     {{scope.row.specValLists[index]}}
                   </template>
                 </el-table-column>
+                <el-table-column label="规格编码" align="center" width="150">
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.skuCode" placeholder="请输入规格编码" size="mini" />
+                  </template>
+                </el-table-column>
                 <el-table-column label="销售价格" align="center" width="150">
                   <template slot-scope="scope">
                     <el-input-number v-model="scope.row.salePrice" :precision="2" :step="0.1" :min="0" controls-position="right" size="mini" />
@@ -457,6 +465,13 @@ export default {
     handleUser() {
       this.userInfoVO = this.getUserInfo()
     },
+    onChangeGoodsType() {
+      this.queryParams.goodsType = this.goodsType
+      this.handleQuery()
+      // 重新获取品牌和分类列表
+      this.getBrandList()
+      this.getCategoryList()
+    },
     getBrandList() {
       listBrand({ ...this.queryParams2, goodsType: this.goodsType }).then(response => {
         this.brandList = response.rows || []
@@ -534,9 +549,6 @@ export default {
       this.reset()
       this.open = true
       this.title = '添加商品管理'
-      // 重新获取品牌和分类列表
-      this.getBrandList()
-      this.getCategoryList()
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -707,7 +719,7 @@ export default {
       this.$message.error('最多上传9个图片!')
     },
     gotoComment(row) {
-      this.$router.push({ path: `/platform/goodsComment/appGoodsComment?goodsType=${this.goodsType}&goodsId=${row.id}` })
+      this.$router.push({ path: `/system/goodsComment/appGoodsComment?goodsType=${this.goodsType}&goodsId=${row.id}` })
     },
     handleSkuTypeChange(val) {
       if (val === 0) {
@@ -804,6 +816,7 @@ export default {
 
         return {
           specValLists: specs,
+          skuCode: existingSku ? existingSku.skuCode : '',
           salePrice: existingSku ? existingSku.salePrice : 0,
           costPrice: existingSku ? existingSku.costPrice : 0,
           purchasePrice: existingSku ? existingSku.purchasePrice : 0,

+ 8 - 1
admin-ui/src/views/goods/goodsComment/index.vue

@@ -1,5 +1,8 @@
 <template>
     <div class="app-container">
+      <el-tabs v-model="goodsType" @tab-click="onChangeGoodsType">
+        <el-tab-pane v-for="dict in dict.type.goods_type" :label="dict.label" :name="dict.value"></el-tab-pane>
+      </el-tabs>
         <!-- 搜索区域卡片 -->
         <el-card class="search-card" shadow="never">
             <el-form :model="queryParams" ref="queryForm" @submit.native.prevent :inline="true" label-width="100px">
@@ -288,7 +291,7 @@ import { listGoodsComment, getGoodsComment, delGoodsComment, addGoodsComment, up
 
 export default {
     name: 'GoodsComment',
-    dicts: ['sys_normal_disable', 'sys_yes_no', 'sys_job_status'],
+    dicts: ['sys_normal_disable','goods_type', 'sys_yes_no', 'sys_job_status'],
     data() {
         return {
             // 遮罩层
@@ -379,6 +382,10 @@ export default {
                 this.queryParams.createTimeTo = this.queryCreateTime[1]
             }
         },
+      onChangeGoodsType() {
+        this.queryParams.goodsType = this.goodsType
+        this.handleQuery()
+      },
         /** 查询商品评论列表 */
         getList() {
             this.$nextTick(() => {

+ 11 - 6
admin-ui/src/views/systemSet/purchaseGoods/index.vue

@@ -16,9 +16,12 @@
         </el-form>
 
         <el-row :gutter="10" class="mb8">
-            <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" @click="addOrder" v-hasPermi="['order:purchaseGoods:add']">新增</el-button>
-            </el-col>
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(0)" v-hasPermi="['order:purchaseGoods:add']">普通商品采购</el-button>
+            <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(1)" v-hasPermi="['order:purchaseGoods:add']">材料商品采购</el-button>
+            <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(2)" v-hasPermi="['order:purchaseGoods:add']">生活服务商品采购</el-button>
+            <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(3)" v-hasPermi="['order:purchaseGoods:add']">汽车美容商品采购</el-button>
+          </el-col>
             <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
@@ -516,12 +519,13 @@ export default {
                 this.loading = false
             })
         },
-        addOrder() {
+        addOrder(type) {
             this.open = true
             this.isUserBalance = false
             this.getBalance()
-            this.title = this.goodsType == '0' ? '商品进货' : '材料申请'
-            this.titleType = this.goodsType == '0' ? '商品分类' : '材料分类'
+            this.goodsType = type
+            this.title = this.goodsType == '0' ? '商品采购' : '商品采购'
+            this.titleType = this.goodsType == '0' ? '商品分类' : '商品分类'
             this.purchaseCountVOList = []
             this.addGoodsList = []
             this.addGoodsList = []
@@ -624,6 +628,7 @@ export default {
                     let purchaseGoodsVO = {
                         skuId: vo.id,
                         goodsId: vo.goodsId,
+                        goodsName: vo.goodsName,
                         goodsCategoryId: purchaseVO.goodsCategoryId,
                         costPrice: vo.purchasePrice,
                         buyNum: purchaseVO.count,

+ 747 - 0
admin-ui/src/views/systemSet/purchaseGoods/platform.vue

@@ -0,0 +1,747 @@
+<template>
+    <div class="app-container">
+        <el-form :model="queryParams" ref="queryForm" @submit.native.prevent :inline="true" v-show="showSearch" label-width="68px">
+            <el-form-item prop="orderNo">
+                <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
+            </el-form-item>
+            <el-form-item prop="orderStatus">
+                <el-select v-model="queryParams.orderStatus" placeholder="请选择支付状态" clearable>
+                    <el-option v-for="dict in dict.type.purchase_order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
+                </el-select>
+            </el-form-item>
+            <el-form-item>
+                <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+                <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+            </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+                <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(0)" v-hasPermi="['order:purchaseGoods:add']">普通商品采购</el-button>
+               <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(1)" v-hasPermi="['order:purchaseGoods:add']">材料商品采购</el-button>
+              <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(2)" v-hasPermi="['order:purchaseGoods:add']">生活服务商品采购</el-button>
+              <el-button type="primary" plain icon="el-icon-plus" @click="addOrder(3)" v-hasPermi="['order:purchaseGoods:add']">汽车美容商品采购</el-button>
+            </el-col>
+            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <Page uri="/mapi/order/purchaseGoods/list" :request-params="queryParams" ref="pagination">
+            <!--      <el-table-column type="selection" width="55" align="center" fixed="left"/>-->
+            <el-table-column label="订单编号" align="center" prop="orderNo" width="200px" />
+            <el-table-column label="进货总价(元)" align="center" prop="costTotalPrice" width="150px" />
+            <el-table-column label="下单方式" align="center" prop="payType" width="150px">
+                <template slot-scope="scope">
+                    <dict-tag :options="dict.type.recharge_pay_type" :value="scope.row.payType" />
+                </template>
+            </el-table-column>
+            <el-table-column label="订单状态" align="center" prop="orderStatus" width="150px">
+                <template slot-scope="scope">
+                    <dict-tag :options="dict.type.purchase_order_status" :value="scope.row.orderStatus" />
+                </template>
+            </el-table-column>
+            <el-table-column label="下单时间" align="center" prop="createTime" width="150px" />
+            <el-table-column label="支付时间" align="center" prop="payTime" width="150px" />
+            <el-table-column label="发货时间" align="center" prop="sendTime" width="150px" >
+                <template slot-scope="scope">
+                    <span>{{ scope.row.sendTime ? scope.row.sendTime : '--' }}</span>
+                </template>
+                </el-table-column>
+            <el-table-column label="收货时间" align="center" prop="finishTime" width="150px" >
+                <template slot-scope="scope">
+                    <span>{{ scope.row.finishTime ? scope.row.finishTime : '--' }}</span>
+                </template>
+                </el-table-column>
+            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
+                <template slot-scope="scope">
+                    <el-button type="text" icon="el-icon-chat-dot-square" @click="orderDetail(scope.row)">订单详情</el-button>
+                    <el-button type="text" icon="el-icon-check" @click="confirmReceive(scope.row)" v-hasPermi="['order:purchaseGoods:edit']" v-if="scope.row.orderStatus == '3' || scope.row.orderStatus == '4'">确认收货</el-button>
+                </template>
+            </el-table-column>
+        </Page>
+
+        <!--新增-->
+        <el-dialog :title="title" :visible.sync="open" size="80%" append-to-body>
+            <el-card class="purchase-dialog">
+                <el-row :gutter="20" class="purchase-container">
+                    <!-- 左侧分类选择区域 -->
+                    <el-col :span="4" class="category-section">
+                        <div class="section-title">{{ titleType }}</div>
+                        <div class="category-tree">
+                            <el-tree
+                                :data="categoryList"
+                                :props="defaultProps"
+                                :expand-on-click-node="false"
+                                node-key="id"
+                                default-expand-all
+                                highlight-current
+                                @node-click="handleNodeClick"
+                            />
+                        </div>
+                    </el-col>
+
+                    <!-- 右侧内容区域 -->
+                    <el-col :span="20" class="content-section">
+                        <!-- 上半区:已采购商品列表 -->
+                        <div class="purchased-section">
+                            <div class="section-title">已采购商品</div>
+                            <el-table :data="addGoodsList" border stripe>
+                                <el-table-column label="商品名称" align="center" prop="goodsName" min-width="200" />
+                                <el-table-column label="商品规格" align="center" min-width="150">
+                                    <template slot-scope="scope">
+                                        {{formatSpec(scope.row.specValLists)}}
+                                    </template>
+                                </el-table-column>
+                                <el-table-column label="数量" align="center" width="120">
+                                    <template slot-scope="scope">
+                                        <el-input
+                                            v-if="scope.row.goodsSkuStoreId == vo.goodsSkuStoreId"
+                                            v-for="vo in purchaseCountVOList"
+                                            :key="vo.goodsSkuStoreId"
+                                            v-model="vo.count"
+                                            :step="1"
+                                            :min="1"
+                                            :max="getMaxCount(scope.row)"
+                                            @change="countPrice"
+                                        />
+                                    </template>
+                                </el-table-column>
+                              <el-table-column label="采购价格" align="center" width="120">
+                                <template slot-scope="scope">
+                                  <el-input
+                                    v-if="scope.row.goodsSkuStoreId == vo.goodsSkuStoreId"
+                                    v-for="vo in purchaseCountVOList"
+                                    :key="vo.goodsSkuStoreId"
+                                    v-model="vo.costPrice"
+                                    @change="countPrice"
+                                  />
+                                </template>
+                              </el-table-column>
+                                <el-table-column label="操作" align="center" width="100" fixed="right">
+                                    <template slot-scope="scope">
+                                        <el-button type="text" icon="el-icon-delete" @click="deleteGoods(scope.row)">删除</el-button>
+                                    </template>
+                                </el-table-column>
+                            </el-table>
+                        </div>
+
+                        <!-- 下半区:商品列表 -->
+                        <div class="goods-section">
+                            <div class="section-title">商品列表</div>
+                            <el-form :inline="true" :model="goodsQueryParams" class="search-form">
+                                <el-form-item label="搜索商品">
+                                    <el-input
+                                        v-model="goodsQueryParams.keywords"
+                                        placeholder="请输入商品名称或条码"
+                                        clearable
+                                        @keyup.enter.native="getGoodsList"
+                                    />
+                                </el-form-item>
+                                <el-form-item>
+                                    <el-button type="primary" @click="getGoodsList">搜索</el-button>
+                                    <el-button @click="resetGoodsQuery">重置</el-button>
+                                </el-form-item>
+                            </el-form>
+                            <el-table
+                                v-loading="loading"
+                                :data="goodsList"
+                                border
+                                stripe
+                                highlight-current-row
+                            >
+                                <el-table-column label="商品名称" align="center" prop="goodsName" min-width="200" />
+                                <el-table-column label="商品规格" align="center" min-width="150">
+                                    <template slot-scope="scope">
+                                        {{formatSpec(scope.row.specValLists)}}
+                                    </template>
+                                </el-table-column>
+                                <el-table-column label="采购价格" align="center" prop="costPrice" width="100" />
+                                <el-table-column label="库存" align="center" width="120">
+                                    <template slot-scope="scope">
+                                        <span :class="{'low-stock': scope.row.stock <= 5}">{{ scope.row.stock }}</span>
+                                        <el-tag v-if="scope.row.stock <= 5" size="mini" type="warning">库存不足</el-tag>
+                                    </template>
+                                </el-table-column>
+
+                                <el-table-column label="操作" align="center" width="100" fixed="right">
+                                    <template slot-scope="scope">
+                                        <el-button
+                                            type="text"
+                                            icon="el-icon-plus"
+                                            @click="addGoods(scope.row)"
+                                        >
+                                            添加
+                                        </el-button>
+                                    </template>
+                                </el-table-column>
+                            </el-table>
+                            <pagination
+                                v-show="goodsTotal > 0"
+                                :total="goodsTotal"
+                                :page.sync="goodsQueryParams.pageNum"
+                                :limit.sync="goodsQueryParams.pageSize"
+                                @pagination="getGoodsList"
+                            />
+                        </div>
+                    </el-col>
+                </el-row>
+
+                <!-- 底部结算区域 -->
+                <el-row :gutter="10" class="settlement-section">
+                    <el-col :span="3">
+                        <el-form label-width="100px" :inline="true" size="small">
+                            <el-form-item v-if="goodsType == '1' && userInfoVO.userType != '00'">
+                                <el-checkbox v-model="isUserBalance">是否使用余额</el-checkbox>
+                            </el-form-item>
+                        </el-form>
+                    </el-col>
+                    <el-col :span="17">
+                        <el-form label-width="135px" :inline="true" size="small">
+                            <el-form-item label="总件数:" prop="totalClothNum">
+                                <span class="price-text">{{ calculateTotalCount }}</span>
+                            </el-form-item>
+                            <el-form-item label="总金额(元):" prop="totalPrice">
+                                <span class="price-text">{{ calculateTotalPrice }}</span>
+                            </el-form-item>
+                            <el-form-item label="抵扣金额(元): " v-if="isUserBalance == true">
+                                <span class="price-text">{{ getNowBalance }}</span>
+                            </el-form-item>
+                            <el-form-item label="还需支付金额(元): " v-if="isUserBalance == true">
+                                <span class="price-text">{{ getNeedPayPrice }}</span>
+                            </el-form-item>
+                        </el-form>
+                    </el-col>
+                    <el-col :span="4">
+                        <el-button
+                            type="primary"
+                            icon="el-icon-shopping-cart-2"
+                            size="small"
+                            @click="submitForm"
+                        >
+                            提交
+                        </el-button>
+                    </el-col>
+                </el-row>
+            </el-card>
+        </el-dialog>
+
+        <!--    详情-->
+        <el-dialog :title="detailTitle" :visible.sync="openDetail" size="80%" append-to-body>
+            <el-card>
+                <el-descriptions title="基本信息" v-show="detailView" :column="3" border :label-style="{ 'text-align': 'center' }" :contentStyle="{ 'text-align': 'center' }">
+                    <el-descriptions-item label="采购来源" span="3">{{ detailView.orgName ? detailView.orgName : '--' }}</el-descriptions-item>
+                    <el-descriptions-item label="订单状态">
+                        <dict-tag :options="dict.type.purchase_order_status" :value="detailView.orderStatus" />
+                    </el-descriptions-item>
+                    <el-descriptions-item label="下单时间">{{ detailView.createTime ? detailView.createTime : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="支付时间">{{ detailView.payTime ? detailView.payTime : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="发货时间">{{ detailView.sendTime ? detailView.sendTime : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="确认收货时间">{{ detailView.finishTime ? detailView.finishTime : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="订单总价(元)">{{ costTotalPrice ? costTotalPrice : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="物流公司">{{ detailView.deliveryCompany ? detailView.deliveryCompany : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="物流单号" span="2">{{ detailView.deliveryNo ? detailView.deliveryNo : '暂无信息' }}</el-descriptions-item>
+                    <el-descriptions-item label="收货地址" span="3">{{ detailView.province }}{{ detailView.city }}{{ detailView.area }}{{ detailView.address }}{{ detailView.addressDetail }}</el-descriptions-item>
+                    <el-descriptions-item label="备注信息" span="3">{{ detailView.remark ? detailView.remark : '暂无信息' }}</el-descriptions-item>
+                </el-descriptions>
+            </el-card>
+            <div class="head-column2">
+                <el-table v-loading="loading" fit highlight-current-row border stripe :data="detailList">
+                    <el-table-column :label="goodsType == 0 ? '商品名称' : '材料名称'" align="center" prop="goodsName" width="250px" />
+                    <el-table-column :label="goodsType == 0 ? '商品规格' : '材料规格'" align="center" width="250px">
+                        <template slot-scope="scope">
+                            <div style="text-align: center">{{ scope.row.skuName }}</div>
+                        </template>
+                    </el-table-column>
+                    <el-table-column label="数量" align="center" prop="buyNum" />
+                    <el-table-column label="价格(元)" align="center" prop="costPrice" />
+                    <el-table-column label="总和(元)" align="center">
+                        <template slot-scope="scope">
+                            <span>{{ (scope.row.buyNum * 10000 * parseFloat(scope.row.costPrice)) / 10000 }}</span>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </div>
+            <el-row :gutter="10" class="box-shadow" style="margin-top: 10px">
+                <el-col :span="21">
+                    <el-form label-width="130px" style="height: 80px; padding-top: 20px; text-align: right" :inline="true" size="small">
+                        <el-form-item label="总金额(元):">
+                            {{ costTotalPrice }}
+                        </el-form-item>
+                    </el-form>
+                </el-col>
+            </el-row>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { purchaseListSku } from '@/api/core/sku'
+import { listCategory } from '@/api/core/category'
+import { addPurchaseGoods, getPurchaseGoods, listPurchaseGoods, confirmReceiveGoodsByOrderGoods } from '@/api/order/purchaseGoods'
+import { getFactoryInfo } from '@/api/system/factory'
+import { getStoreInfo } from '@/api/system/store'
+export default {
+    name: 'goodsPurchase',
+    dicts: ['purchase_order_status', 'recharge_pay_type'],
+    data() {
+        return {
+            //
+            orderLoading: true,
+            // 遮罩层
+            loading: false,
+            detailLoading: true,
+            // 选中数组
+            ids: [],
+            // 非单个禁用
+            single: true,
+            // 非多个禁用
+            multiple: true,
+            // 显示搜索条件
+            showSearch: true,
+            // 总条数
+            total: 0,
+            // 弹出层标题
+            title: '商品采购',
+            titleType: '商品分类',
+            detailTitle: '',
+            // 详情数据
+            detailView: {},
+            // 是否显示弹出层
+            open: false,
+            openDetail: false,
+            // 查询参数
+            queryParams: {},
+            // 表单参数
+            form: {},
+            // 表单校验
+            rules: {},
+            goodsType: null,
+            // 商品订单表格数据
+            purchaseGoodsList: [],
+            // 分类id
+            goodsCategoryId: null,
+            // 可选商品集合
+            goodsList: null,
+            // 已选商品集合
+            addGoodsList: [],
+            // 左侧分类集合
+            categoryList: null,
+            //
+            defaultProps: {
+                label: 'categoryName'
+            },
+            // 自定义一个计算数量的临时对象集合
+            purchaseCountVOList: [],
+            // 总金额
+            totalPrice: 0,
+            // 总件数
+            totalCount: 0,
+            // 当前余额
+            getNowBalance: 0,
+            // 提交的参数对象
+            submitGoodsOrderVO: {},
+            // 详情数据
+            detailList: [],
+            // 详情总金额
+            costTotalPrice: null,
+            userInfoVO: null,
+            isUserBalance: false,
+            orgName: '',
+            stockWarningThreshold: 5, // 库存预警阈值
+            // 商品列表分页参数
+            goodsQueryParams: {
+                pageNum: 1,
+                pageSize: 10,
+                categoryId: null,
+                keywords: undefined
+            },
+            // 商品总数
+            goodsTotal: 0,
+        }
+    },
+    created() {
+        this.handleUser()
+        this.getList()
+    },
+    computed: {
+        calculateTotalCount() {
+            this.totalCount = 0
+            this.addGoodsList.forEach((vo) => {
+                let number = Number(this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId).count);
+                this.totalCount = this.totalCount + number;
+            })
+            return this.totalCount
+        },
+
+        calculateTotalPrice() {
+            this.totalPrice = 0
+            this.addGoodsList.forEach((vo) => {
+                let number = this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId).count
+              let costPrice = this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId).costPrice
+                this.totalPrice = this.totalPrice + number * costPrice
+            })
+            return this.totalPrice
+        },
+        getNowBalanceValue() {
+            return this.getNowBalance
+        },
+        getNeedPayPrice() {
+            // 当订单金额 = 余额
+            if (this.totalPrice == this.getNowBalance) {
+                return 0
+            }
+            // 当订单金额 大于 余额
+            if (this.totalPrice > this.getNowBalance) {
+                return (parseFloat(this.totalPrice) * 10000 - parseFloat(this.getNowBalance) * 10000) / 10000
+            }
+            // 当订单金额 小于等于 余额
+            return (parseFloat(this.getNowBalance) * 10000 - parseFloat(this.totalPrice) * 10000) / 10000
+        },
+        lowStockItems() {
+            return this.goodsList.filter(item => item.stock <= this.stockWarningThreshold);
+        }
+    },
+    methods: {
+        handleUser() {
+            this.userInfoVO = this.getUserInfo()
+            if (this.userInfoVO.userType == '00') {
+                this.orgName = '总部'
+            }
+            if (this.userInfoVO.userType == '01') {
+                this.orgName = '工厂名称'
+            }
+            if (this.userInfoVO.userType == '02') {
+                this.orgName = '门店名称'
+            }
+        },
+                    // 格式化规格信息
+    formatSpec(specList) {
+      if (!specList || !specList.length) return '默认规格';
+      return specList.join(' ');
+    },
+        getCategoryList() {
+            listCategory({ ...this.queryParams, ...{ goodsType: this.goodsType } }).then((response2) => {
+                this.categoryList = response2.rows
+            })
+        },
+        deleteGoods(row) {
+            this.addGoodsList = this.addGoodsList.filter((item) => {
+                return item.goodsSkuStoreId !== row.goodsSkuStoreId
+            })
+            this.purchaseCountVOList = this.purchaseCountVOList.filter((item) => {
+                return item.goodsSkuStoreId !== row.goodsSkuStoreId
+            })
+        },
+        addGoods(row) {
+            // 非总部进货
+            if (this.userInfoVO.userType != '00') {
+                // 如果已添加集合数量大于0,需要判断当前添加的是否在已添加集合中
+                if (this.addGoodsList.length > 0) {
+                    let match = this.addGoodsList.findIndex(item => item.goodsSkuStoreId == row.goodsSkuStoreId);
+                    if (match !== -1) {
+                        let purchaseVo = this.purchaseCountVOList.find(item => item.goodsSkuStoreId == row.goodsSkuStoreId);
+                        purchaseVo.count++;
+                        this.$forceUpdate();
+                        return;
+                    }
+                }
+
+                // 不在已添加集合中,直接加入集合中
+                this.addGoodsList.push(row);
+                this.purchaseCountVOList.push({
+                    'goodsSkuStoreId': row.goodsSkuStoreId,
+                    'goodsCategoryId': this.goodsCategoryId,
+                    'skuName': this.formatSpec(row.specValLists),
+                    'costPrice': row.costPrice,
+                    'count': 1
+                });
+                this.$forceUpdate();
+            } else {
+                // 总部进货逻辑保持不变
+                if (this.addGoodsList.length > 0) {
+                    let match = this.addGoodsList.findIndex(item => item.goodsSkuStoreId == row.goodsSkuStoreId);
+                    if (match !== -1) {
+                        this.purchaseCountVOList.find(item => item.goodsSkuStoreId == row.goodsSkuStoreId).count++;
+                        this.$forceUpdate();
+                        return;
+                    }
+                }
+
+                this.addGoodsList.push(row);
+                this.purchaseCountVOList.push({
+                    'goodsSkuStoreId': row.goodsSkuStoreId,
+                    'goodsCategoryId': this.goodsCategoryId,
+                    'skuName': this.formatSpec(row.specValLists),
+                    'costPrice': row.costPrice,
+                    'count': 1
+                });
+                this.$forceUpdate();
+            }
+        },
+        getMaxCount(row) {
+            if (this.userInfoVO.userType != '00') {
+                return row.stock
+            } else {
+                return 99999
+            }
+        },
+        countPrice() {
+            this.totalPrice = 0
+            this.totalCount = 0
+            this.addGoodsList.forEach((vo) => {
+                let number = this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId).count
+                let costPrice = this.purchaseCountVOList.find((item) => item.goodsSkuStoreId == vo.goodsSkuStoreId).costPrice
+                this.totalPrice = this.totalPrice + number * costPrice
+                this.totalCount = this.totalCount + number
+            })
+        },
+        // 节点单击事件
+        handleNodeClick(data) {
+            this.goodsCategoryId = data.id
+            this.getGoodsList()
+        },
+        getList() {
+            this.$nextTick(() => {
+                this.$refs.pagination.handleSearch(true)
+            })
+        },
+        getGoodsList() {
+            this.loading = true
+            if (this.goodsCategoryId == null) {
+                this.goodsList = []
+                this.goodsTotal = 0
+                this.loading = false
+                return
+            }
+            this.goodsQueryParams.categoryId = this.goodsCategoryId
+            purchaseListSku(this.goodsQueryParams).then((response) => {
+                this.goodsList = response.rows
+                this.goodsTotal = response.total
+                this.loading = false
+            })
+        },
+        addOrder(type) {
+            this.open = true
+            this.isUserBalance = false
+            this.getBalance()
+            this.goodsType = type
+            // this.title = this.goodsType == '0' ? '商品进货' : '材料申请'
+            // this.titleType = this.goodsType == '0' ? '商品分类' : '材料分类'
+            this.purchaseCountVOList = []
+            this.addGoodsList = []
+            this.addGoodsList = []
+            this.goodsList = []
+            this.getCategoryList()
+        },
+        getBalance() {
+            if (this.userInfoVO.userType == '01') {
+                getFactoryInfo().then((response) => {
+                    this.getNowBalance = response.data.balance
+                })
+            }
+            if (this.userInfoVO.userType == '02') {
+                getStoreInfo().then((response) => {
+                    this.getNowBalance = response.data.balance
+                })
+            }
+        },
+        // 取消按钮
+        cancel() {
+            this.open = false
+            this.reset()
+        },
+        // 多选框选中数据
+        handleSelectionChange(selection) {
+            this.ids = selection.map((item) => item.id)
+            this.single = selection.length !== 1
+            this.multiple = !selection.length
+        },
+        /** 搜索按钮操作 */
+        handleQuery() {
+            this.queryParams.pageNum = 1
+            this.getList()
+        },
+        /** 重置按钮操作 */
+        resetQuery() {
+            this.resetForm('queryForm')
+            this.handleQuery()
+        },
+        orderDetail(row) {
+            this.openDetail = true
+            this.detailTitle = '订单商品详情'
+            this.detailLoading = true
+            this.detailList = []
+            this.detailView = {}
+            const id = row.id
+            getPurchaseGoods(id).then((response) => {
+                this.detailView = response.data
+                this.detailList = response.data.orderPurchaseGoodsVOList
+                this.costTotalPrice = this.detailList[0].costTotalPrice
+                this.detailLoading = false
+            })
+        },
+        confirmReceive(row) {
+            this.$confirm('是否确认收货?')
+                .then(() => {
+                    confirmReceiveGoodsByOrderGoods(row.id).then((response2) => {
+                        this.$message.success('操作成功')
+                        this.getList()
+                    })
+                })
+                .catch(() => {})
+        },
+        checkClose(done) {
+            this.$confirm('是否关闭表单,关闭后数据将丢失?')
+                .then(function () {
+                    done()
+                })
+                .then(() => {})
+                .catch(() => {})
+        },
+        submitForm() {
+            this.$confirm('是否确认下单?').then(() => {
+                if (this.totalCount == 0) {
+                    this.$message.error('商品数量为空,无法操作提交');
+                    return;
+                }
+
+                // 检查库存
+                for (let item of this.addGoodsList) {
+                    let purchaseVo = this.purchaseCountVOList.find(pur => pur.goodsSkuStoreId === item.goodsSkuStoreId);
+                }
+
+                this.submitGoodsOrderVO = {
+                    costTotalPrice: this.totalPrice,
+                    goodsType: this.goodsType,
+                    purchaseGoodsVOList: [],
+                    isUserBalance: this.userInfoVO.userType != '00' && this.isUserBalance
+                };
+
+                // 构建商品列表
+                this.addGoodsList.forEach(vo => {
+                    let purchaseVO = this.purchaseCountVOList.find(item => item.goodsSkuStoreId == vo.goodsSkuStoreId);
+                    let purchaseGoodsVO = {
+                        skuId: vo.id,
+                        goodsId: vo.goodsId,
+                        goodsName: vo.goodsName,
+                        goodsCategoryId: purchaseVO.goodsCategoryId,
+                        costPrice: purchaseVO.costPrice,
+                        buyNum: purchaseVO.count,
+                        skuName: purchaseVO.skuName
+                    };
+                    this.submitGoodsOrderVO.purchaseGoodsVOList.push(purchaseGoodsVO);
+                });
+
+                // 提交订单
+                addPurchaseGoods(this.submitGoodsOrderVO).then(response => {
+                    this.$modal.msgSuccess('提交成功');
+                    this.open = false;
+                    this.getList();
+                }).catch(error => {
+                    this.$modal.msgError(error.message || '提交失败');
+                });
+            }).catch(() => {});
+        },
+        resetGoodsQuery() {
+            this.goodsQueryParams.keywords = undefined;
+            this.getGoodsList();
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+.purchase-dialog {
+  .purchase-container {
+    min-height: 600px;
+  }
+
+  .category-section {
+    border-right: 1px solid #EBEEF5;
+    height: 100%;
+
+    .section-title {
+      font-size: 16px;
+      font-weight: bold;
+      margin-bottom: 15px;
+      padding: 0 10px;
+    }
+
+    .category-tree {
+      height: calc(100% - 40px);
+      overflow-y: auto;
+    }
+  }
+
+  .content-section {
+    display: flex;
+    flex-direction: column;
+    gap: 20px;
+  }
+
+  .section-title {
+    font-size: 16px;
+    font-weight: bold;
+    margin-bottom: 15px;
+  }
+
+  .purchased-section,
+  .goods-section {
+    background: #fff;
+    border-radius: 4px;
+    padding: 15px;
+  }
+
+  .search-form {
+    margin-bottom: 15px;
+  }
+
+  .settlement-section {
+    margin-top: 20px;
+    padding-top: 20px;
+    border-top: 1px solid #EBEEF5;
+  }
+
+  .price-text {
+    color: #ff4949;
+    font-weight: bold;
+  }
+
+  .low-stock {
+    color: #e6a23c;
+    font-weight: bold;
+  }
+
+  .el-table {
+    th {
+      background-color: #f5f7fa;
+      color: #606266;
+      font-weight: 500;
+    }
+
+    td {
+      padding: 8px 0;
+    }
+  }
+
+  .el-button--text {
+    padding: 0 5px;
+
+    &:hover {
+      color: #409EFF;
+    }
+
+    &.is-disabled {
+      color: #c0c4cc;
+      cursor: not-allowed;
+
+      &:hover {
+        color: #c0c4cc;
+      }
+    }
+  }
+
+  .el-tag {
+    margin-left: 5px;
+    vertical-align: middle;
+  }
+}
+</style>

+ 0 - 0
log.path_IS_UNDEFINED/sys-error.log


+ 0 - 0
log.path_IS_UNDEFINED/sys-info.log


+ 0 - 0
log.path_IS_UNDEFINED/sys-user.log


+ 6 - 0
yiqi-common/src/main/java/com/yiqi/core/domain/vo/GoodsSkuQueryVO.java

@@ -40,6 +40,12 @@ public class GoodsSkuQueryVO implements Serializable {
     @ApiModelProperty("商品编号")
     private Long goodsId;
 
+    /**
+     * 商品编号
+     */
+    @Excel(name = "商品编号")
+    private String skuCode;
+
     /**
      * 商品编号
      */

+ 0 - 1
yiqi-common/src/main/java/com/yiqi/system/domain/SysNotice.java

@@ -25,7 +25,6 @@ public class SysNotice extends BaseEntity {
      * 公告ID
      */
     @TableId(type = IdType.AUTO)
-
     private Long noticeId;
 
     /**

+ 10 - 1
yiqi-core/src/main/java/com/yiqi/core/service/impl/GoodsInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package com.yiqi.core.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
 
 /**
  * 商品管理Service业务层处理
@@ -128,7 +130,11 @@ public class GoodsInfoServiceImpl extends ServiceImpl<GoodsInfoMapper, GoodsInfo
         //如果是单规格
         if (goods.getSkuType() == 0) {
             GoodsSku goodsSku = new GoodsSku();
-            goodsSku.setSkuCode(goods.getGoodsCode());
+            if(StringUtils.isNotBlank(goods.getGoodsCode())){
+                goodsSku.setSkuCode(goods.getGoodsCode());
+            }else{
+                goodsSku.setSkuCode(goods.getId()+ RandomUtil.randomNumbers(6));
+            }
             goodsSku.setSalePrice(goods.getSingleSkuPrice());
             goodsSku.setCostPrice(goods.getSingleSkuCostPrice());
             goodsSku.setPurchasePrice(goods.getSingleSkuPurchasePrice());
@@ -157,6 +163,9 @@ public class GoodsInfoServiceImpl extends ServiceImpl<GoodsInfoMapper, GoodsInfo
                 goodsSku.setSourceType(SourceType.MANAGER.getCode());
                 goodsSku.setStatus("0");
                 goodsSku.setDelFlag("0");
+                if(StringUtils.isBlank(goodsSku.getSkuCode())){
+                    goodsSku.setSkuCode(goods.getId()+ RandomUtil.randomNumbers(6));
+                }
                 goodsSku.buildCreateData();
                 goodsSkuMapper.insert(goodsSku);
             });

+ 0 - 2
yiqi-core/src/main/java/com/yiqi/core/service/impl/GoodsSkuServiceImpl.java

@@ -171,8 +171,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
     }
 
     public void insertSkuStore(GoodsSkuAddVO goodsSkuAddVO, GoodsSku goodsSku) {
-
-
         // 新增工厂物料关系
         GoodsSkuStore factory = new GoodsSkuStore();
         factory.setGoodsSkuId(goodsSku.getId());

+ 1 - 2
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderPurchaseGoodsServiceImpl.java

@@ -482,8 +482,7 @@ public class OrderPurchaseGoodsServiceImpl extends ServiceImpl<OrderPurchaseGood
             // 查询本次订单内容
             List<OrderPurchaseGoodsSku> orderPurchaseGoodsSkus = orderPurchaseGoodsSkuService.list(new QueryWrapper<OrderPurchaseGoodsSku>().lambda()
                     .eq(OrderPurchaseGoodsSku::getOrderId, orderPurchaseGoods.getId()));
-            List<GoodsSkuStore> goodsSkuStoreList = goodsSkuStoreService.buildGoodsSkuStockVOByPurchase2AddStock(orderPurchaseGoodsSkus, orderPurchaseGoods);
-            goodsSkuStoreService.addGoodsSkuStockByOrderItems(goodsSkuStoreList);
+            goodsSkuService.addOrMinusGoodsSkuStockByPurchase(1, orderPurchaseGoodsSkus);
             // 库存记录
             this.buildStockRecord(orderPurchaseGoods, orderPurchaseGoodsSkus, Boolean.TRUE, Boolean.FALSE);
         }

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/ClothColorMapper.xml

@@ -56,7 +56,7 @@
                             and update_by_id = #{updateById}
                         </if>
         </where>
-        order by sort
+        order by sort desc
     </select>
 
     <select id="selectClothColorById" parameterType="Long"

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/ClothCustomItemMapper.xml

@@ -44,7 +44,7 @@
                             and update_by_id = #{updateById}
                         </if>
         </where>
-        order by sort
+        order by sort desc
     </select>
 
     <select id="selectClothItemById" parameterType="Long"

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/ClothFlawTopMapper.xml

@@ -28,7 +28,7 @@
                             and flaw.id = #{flawId}
                         </if>
         </where>
-        order by flaw.sort
+        order by flaw.sort desc
     </select>
 
     <select id="selectClothFlawTopById" parameterType="Long"

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/ClothFlawTypeMapper.xml

@@ -38,7 +38,7 @@
                 and status = #{status}
             </if>
         </where>
-        order by sort
+        order by sort desc
     </select>
 
     <select id="selectClothFlawTypeById" parameterType="Long"

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/ClothItemMapper.xml

@@ -83,7 +83,7 @@
                             and item.status = #{status}
                         </if>
         </where>
-        order by item.sort
+        order by item.sort desc
     </select>
 
     <select id="selectClothItemById" parameterType="Long"

+ 2 - 2
yiqi-core/src/main/resources/mapper/core/ClothPriceMapper.xml

@@ -84,7 +84,7 @@
         <if test="clothType != null  and clothType != ''">
             and ab.type_id = #{clothType}
         </if>
-        order by ab.id
+        order by ab.id desc
     </select>
     <select id="countClothPriceListByClothType" resultType="java.lang.Integer">
         select count(1)
@@ -149,7 +149,7 @@
         <if test="storeAreaId != null  and storeAreaId != ''">
             and ab.area_id = #{storeAreaId}
         </if>
-        order by ab.id
+        order by ab.id desc
     </select>
     <select id="countClothPriceListByWashMode" resultType="java.lang.Integer">
         SELECT

+ 1 - 1
yiqi-core/src/main/resources/mapper/core/GoodsInfoMapper.xml

@@ -86,7 +86,7 @@
                 and s.target_id = #{targetId}
             </if>
             and  g.del_flag = '0'
-            order by sort ASC
+            order by sort desc
         </where>
     </select>
 

+ 8 - 9
yiqi-core/src/main/resources/mapper/core/GoodsSkuMapper.xml

@@ -43,7 +43,7 @@
 
     <select id="selectGoodsSkuInfoByFactory" resultType="com.yiqi.core.domain.vo.GoodsSkuQueryVO">
         select a.id as id, a.goods_id as goodsId, c.status as status, a.specs,
-        c.target_id as targetId,
+        a.sku_code as skuCode, c.target_id as targetId,
         c.source_type as sourceType,
         CASE
         WHEN c.sale_price IS NOT NULL AND c.sale_price > 0 THEN c.sale_price
@@ -65,7 +65,7 @@
 
     <select id="selectGoodsSkuInfoByStore" resultType="com.yiqi.core.domain.vo.GoodsSkuQueryVO">
         select a.id as id, a.goods_id as goodsId, c.status as status, a.specs,
-        c.target_id as targetId,
+        a.sku_code as skuCode, c.target_id as targetId,
         c.source_type as sourceType,
         -- 使用 CASE WHEN 逻辑来确定 salePrice 的值
         CASE
@@ -210,13 +210,12 @@
 
     <select id="selectPurchaseGoodsSkuInfoByHq" resultType="com.yiqi.core.domain.vo.GoodsSkuQueryVO">
         select a.id as id, a.goods_id as goodsId, a.status as status,
-        e.goods_name as goodsName, c.id as goodsSkuStoreId,
+        e.goods_name as goodsName, a.id as goodsSkuStoreId,
         a.cost_price as costPrice,
         a.purchase_price as purchasePrice,
-               c.stock as stock
+        a.stock as stock
         from goods_sku a
         left join goods_info e on e.id = a.goods_id
-        left join goods_sku_store c on c.goods_sku_id = a.id and c.source_type = '00'
         where a.del_flag = 0 and a.status = 0
         <if test="goodsIdList != null">
             and a.goods_id in
@@ -228,7 +227,7 @@
             and e.goods_category_id = #{goodsCategoryId}
         </if>
         <if test="keywords != null and keywords != ''">
-            and (e.goods_name like concat('%', #{keywords}, '%') or e.goods_code like concat('%', #{keywords}, '%') )
+            and (e.goods_name like concat('%', #{keywords}, '%') or a.sku_code like concat('%', #{keywords}, '%') )
         </if>
     </select>
 
@@ -278,7 +277,7 @@
             and e.goods_category_id = #{goodsCategoryId}
         </if>
         <if test="keywords != null and keywords != ''">
-            and (e.goods_name like concat('%', #{keywords}, '%') or e.goods_code like concat('%', #{keywords}, '%') )
+            and (e.goods_name like concat('%', #{keywords}, '%') or a.sku_code like concat('%', #{keywords}, '%') )
         </if>
     </select>
 
@@ -361,11 +360,11 @@
 
 
     <update id="addGoodsSkuStockByHq">
-        update goods_sku set stock = stock + #{buyNum} where id = #{skuId} and status = '0'
+        update goods_sku set stock = stock + #{buyNum} where id = #{skuId}
     </update>
 
     <update id="minusGoodsSkuStockNotCheckByHq">
-        update goods_sku set stock = stock - #{buyNum} where id = #{skuId} and status = '0'
+        update goods_sku set stock = stock - #{buyNum} where id = #{skuId}
     </update>
 
 </mapper>

+ 5 - 5
yiqi-core/src/main/resources/mapper/order/OrderRechargeMapper.xml

@@ -78,7 +78,7 @@
             <if test="endPayTime != null and endPayTime !=''">
                 <![CDATA[and a.pay_time <= concat(#{endPayTime}, ' 23:59:59')]]>
             </if>
-            order by a.id DESC
+            order by a.id desc
 
             <if test="pageSizeExport != 0">
                 limit #{pageSizeExport}
@@ -118,7 +118,7 @@
             <if test="realName != null ">
                 and u.real_name = #{realName}
             </if>
-            order by refund_time DESC
+            order by refund_time desc
         </where>
     </select>
 
@@ -137,7 +137,7 @@
         <if test="orderStatus != null and orderStatus != ''">
             and b.order_status = #{orderStatus}
         </if>
-        order by a.create_time DESC
+        order by a.create_time desc
     </select>
     <select id="getRechargeRecordByUserId" resultType="com.yiqi.order.domain.vo.OrderRechargeRecordVO">
         select  a.order_no as orderNo,
@@ -155,7 +155,7 @@
         and a.del_flag='0'
         and a.order_status in ('1','2')
         and a.app_user_id = #{userId}
-        order by pay_time DESC
+        order by pay_time desc
         </where>
     </select>
     <select id="refundRechargeOrderList" resultType="com.yiqi.order.domain.vo.OrderRechargeRefundListVO">
@@ -203,7 +203,7 @@
             <if test="endRefundTime != null and endRefundTime !=''">
                 <![CDATA[and a.refund_time <= concat(#{endRefundTime}, ' 23:59:59')]]>
             </if>
-            order by pay_time DESC
+            order by pay_time desc
             <if test="pageSizeExport != 0">
                 limit #{pageSizeExport}
             </if>

+ 2 - 2
yiqi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -39,7 +39,7 @@
     <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
         <include refid="selectGenTableColumnVo"/>
         where table_id = #{tableId}
-        order by sort
+        order by sort desc
     </select>
 
     <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
@@ -47,7 +47,7 @@
         as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort,
         column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
         from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
-        order by ordinal_position
+        order by ordinal_position desc
     </select>
 
     <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">

+ 3 - 3
yiqi-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -124,7 +124,7 @@
         c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
         FROM gen_table t
         LEFT JOIN gen_table_column c ON t.table_id = c.table_id
-        where t.table_id = #{tableId} order by c.sort
+        where t.table_id = #{tableId} order by c.sort desc
     </select>
 
     <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
@@ -135,7 +135,7 @@
         c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
         FROM gen_table t
         LEFT JOIN gen_table_column c ON t.table_id = c.table_id
-        where t.table_name = #{tableName} order by c.sort
+        where t.table_name = #{tableName} order by c.sort desc
     </select>
 
     <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
@@ -146,7 +146,7 @@
         c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
         FROM gen_table t
         LEFT JOIN gen_table_column c ON t.table_id = c.table_id
-        order by c.sort
+        order by c.sort desc
     </select>
 
     <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">

+ 4 - 0
yiqi-system/src/main/java/com/yiqi/system/service/impl/SysOrgServiceImpl.java

@@ -2,6 +2,7 @@ package com.yiqi.system.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yiqi.common.enums.SourceType;
 import com.yiqi.system.domain.SysOrg;
 import com.yiqi.system.domain.dto.weapp.WeAppOrgQueryDTO;
 import com.yiqi.system.domain.vo.OrgVO;
@@ -20,6 +21,9 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 
     @Override
     public SysOrg findById(Long orgId, String sourceType) {
+        if(sourceType.equals(SourceType.MANAGER.getCode())){
+            return SysOrg.buildManagerOrg();
+        }
         return getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, orgId)
                 .eq(SysOrg::getSourceType, sourceType));
     }

+ 1 - 3
yiqi-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -44,10 +44,8 @@
     </select>
 
     <select id="selectNoticeListByWorkbench"  resultMap="SysNoticeResult">
-        select a.* from sys_notice a left join sys_notice_org_relation b on a.notice_id = b.notice_id
+        select a.* from sys_notice a
         <where>
-            b.source_type = #{sourceType}
-            AND b.org_id = #{orgId}
             AND a.status = "0"
             AND a.notice_type = '2'
             <if test="noticeTitle != null and noticeTitle != ''">

+ 1 - 1
yiqi-system/src/main/resources/mapper/system/SysStoreAreaMapper.xml

@@ -43,7 +43,7 @@
                 and create_by_id = #{createById}
             </if>
         </where>
-        order by sort asc
+        order by sort desc
     </select>
 
     <select id="selectSysStoreAreaById" parameterType="Long"