flower 23 ore fa
parent
commit
c14022d9f0

+ 14 - 2
bin/views.py

@@ -170,7 +170,8 @@ class locationViewSet(viewsets.ModelViewSet):
         container_batch_status = defaultdict(dict)  # 改为字典存储,避免重复记录
         if container_ids:
             container_details = ContainerDetailModel.objects.filter(
-                container_id__in=container_ids
+                container_id__in=container_ids ,
+                is_delete=False
             ).select_related('batch').exclude(status=3)  # 排除已删除或不合格的托盘
             
             for detail in container_details:
@@ -186,8 +187,19 @@ class locationViewSet(viewsets.ModelViewSet):
                         container_batch_status[detail.container_id][status_key] = (
                             detail.batch.check_status if detail.batch else "404",
                             detail.batch.check_time if detail.batch else "no_check_time",
-                            detail.batch.bound_number if detail.batch else "no_batch"
+                            detail.batch.bound_number if detail.batch else "no_batch",
+                            detail.goods_qty-detail.goods_out_qty if detail.goods_qty-detail.goods_out_qty > 0 else 0,
+            
                         )
+                    else:
+                        # 如果批次状态相同,则更新库位数量
+                        if container_batch_status[detail.container_id][status_key][0] == detail.batch.check_status:
+                            container_batch_status[detail.container_id][status_key] = (
+                                detail.batch.check_status,
+                                max(container_batch_status[detail.container_id][status_key][1], detail.batch.check_time),
+                                detail.batch.bound_number,
+                                container_batch_status[detail.container_id][status_key][3] + (detail.goods_qty-detail.goods_out_qty if detail.goods_qty-detail.goods_out_qty > 0 else 0)
+                            )
         
         # 构造返回数据
         return_data = []

+ 3 - 5
container/views.py

@@ -1961,12 +1961,10 @@ class OutTaskViewSet(APIView):
                 left_qty += add_qty
                 last_out_qty = cd.goods_out_qty
                 cd.goods_out_qty += add_qty
-                left_qty += add_qty
+                print(f"{left_qty/25} 更新托盘 {cd.container.container_code} 批次 {cd.batch_id} 出库数量: {cd.goods_out_qty}")
+
                 cd.save()
-                if cd.goods_qty - cd.goods_out_qty == 0:
-                    cd.status = 3
-                    cd.save()
-                # 新建出库detail
+
                 out_batch_detail.objects.create(
                     out_bound_id=bound_list_id,
                     container_id=cd.container_id,

+ 2 - 2
erp/views.py

@@ -466,7 +466,7 @@ class GenerateInbound(APIView):
                 bound_batch_order=standardized_batch,  # 存储标准化批次号
                 warehouse_code='W01',
                 warehouse_name='立体仓',
-                goods_code=material.goods_code,
+                goods_code=material_goods_code ,
                 goods_desc=material.goods_name,
                 goods_std=material.goods_std or '',  # 处理空值
                 goods_unit=material.goods_unit,
@@ -493,7 +493,7 @@ class GenerateInbound(APIView):
                 batch_id=batch,
                 log_type=0,
                 log_date=timezone.now(),
-                goods_code=batch.goods_code,
+                goods_code=material_goods_code ,
                 goods_desc=batch.goods_desc,
                 goods_qty=batch.goods_qty,
                 log_content=f"生产入库批次创建,来源单据:{bill_obj.number}",

File diff suppressed because it is too large
+ 0 - 863
logs/boundBill.log


+ 1 - 1
templates/src/components/goodscard.vue

@@ -125,7 +125,7 @@
       transition-hide="jump-up"
       @show="prepareDialog()"
     >
-      <q-card style="min-width: 800px">
+      <q-card style="min-width: 900px">
         <q-bar
           class="bg-light-blue-10 text-white rounded-borders"
           style="height: 50px"

+ 176 - 176
templates/src/pages/inbound/predeliverystock.vue

@@ -165,144 +165,144 @@
 <router-view />
 
 <script>
-import { getauth, postauth, putauth, deleteauth } from "boot/axios_request";
-import { date, LocalStorage } from "quasar";
+import { getauth, postauth, putauth, deleteauth } from 'boot/axios_request'
+import { date, LocalStorage } from 'quasar'
 
 export default {
-  name: "PageTask",
-  data() {
+  name: 'PageTask',
+  data () {
     return {
-      createDate1: "",
-      createDate2: "",
-      date_range: "",
-      proxyDate: "",
-      date: "",
-      goods_code: "",
-      goods_desc: "",
-      openid: "",
-      login_name: "",
-      authin: "0",
-      searchUrl: "",
-      pathname: "bound/batch/count/",
-      pathname_previous: "",
-      pathname_next: "",
-      separator: "cell",
+      createDate1: '',
+      createDate2: '',
+      date_range: '',
+      proxyDate: '',
+      date: '',
+      goods_code: '',
+      goods_desc: '',
+      openid: '',
+      login_name: '',
+      authin: '0',
+      searchUrl: '',
+      pathname: 'bound/batch/count/',
+      pathname_previous: '',
+      pathname_next: '',
+      separator: 'cell',
       loading: false,
-      height: "",
+      height: '',
       viewForm: false,
 
       table_list: [],
       columns: [
         {
-          name: "expand",
-          label: "",
-          align: "left",
-          headerStyle: "width: 50px",
+          name: 'expand',
+          label: '',
+          align: 'left',
+          headerStyle: 'width: 50px'
         },
 
         {
-          name: "goods_code",
-          label: "存货编码",
-          field: "goods_code",
-          align: "center",
+          name: 'goods_code',
+          label: '存货编码',
+          field: 'goods_code',
+          align: 'center'
         },
         {
-          name: "goods_desc",
-          label: "存货名称",
-          field: "goods_desc",
-          align: "center",
+          name: 'goods_desc',
+          label: '存货名称',
+          field: 'goods_desc',
+          align: 'center'
         },
 
         {
-          name: "total_quantity",
-          label: "在库数目",
-          field: "total_quantity",
-          align: "center",
+          name: 'total_quantity',
+          label: '在库数目',
+          field: 'total_quantity',
+          align: 'center'
         },
 
         {
-          name: "goods_unit",
-          label: "单位",
-          field: "goods_unit",
-          align: "center",
-          headerStyle: "width: 20px",
-        },
+          name: 'goods_unit',
+          label: '单位',
+          field: 'goods_unit',
+          align: 'center',
+          headerStyle: 'width: 20px'
+        }
       ],
-      filter: "",
+      filter: '',
       pagination: {
         page: 1,
-        rowsPerPage: 11,
+        rowsPerPage: 11
       },
       current: 1,
       max: 0,
       total: 0,
       paginationIpt: 1,
       containers: {},
-      timer: null,
-    };
+      timer: null
+    }
   },
   computed: {
-    interval() {
+    interval () {
       return (
-        this.$t("download_center.start") +
-        " - " +
-        this.$t("download_center.end")
-      );
-    },
+        this.$t('download_center.start') +
+        ' - ' +
+        this.$t('download_center.end')
+      )
+    }
   },
   methods: {
-    class_to_name(class_id) {
+    class_to_name (class_id) {
       const class_map = {
-        1: "整盘",
-        2: "托盘组",
-        3: "零盘",
-      };
-      return class_map[class_id];
+        1: '整盘',
+        2: '托盘组',
+        3: '零盘'
+      }
+      return class_map[class_id]
     },
-    handle_row_expand(row) {
-      const _this = this;
-      row.expand = !row.expand;
+    handle_row_expand (row) {
+      const _this = this
+      row.expand = !row.expand
       if (row.expand) {
         // 添加行级 loading 状态
-        _this.$set(row, "loading", true);
-        getauth("bound/batch/count/" + row.id + "/", {})
+        _this.$set(row, 'loading', true)
+        getauth('bound/batch/count/' + row.id + '/', {})
           .then((res) => {
-            _this.$set(row, "batch_items", res.batch_items);
-            console.log("当前的", row.batch_items);
+            _this.$set(row, 'batch_items', res.batch_items)
+            console.log('当前的', row.batch_items)
           })
           .catch((err) => {
-            _this.$q.notify({ message: err.detail, color: "negative" });
+            _this.$q.notify({ message: err.detail, color: 'negative' })
           })
           .finally(() => {
-            row.loading = false; // 关闭加载状态
-          });
+            row.loading = false // 关闭加载状态
+          })
       }
     },
-    getlog() {
+    getlog () {
       // console.log(this.table_list)
-      console.log("当前loading状态:", this.loading);
+      console.log('当前loading状态:', this.loading)
     },
-    getList(params = {}) {
-      var _this = this;
-      _this.loading = true;
+    getList (params = {}) {
+      var _this = this
+      _this.loading = true
       // 合并基础参数
       const baseParams = {
         page: _this.current,
-        page_size: _this.pagination.rowsPerPage,
-      };
+        page_size: _this.pagination.rowsPerPage
+      }
 
       // 创建URLSearchParams处理参数
       const queryParams = new URLSearchParams({
         ...baseParams,
-        ...params,
-      });
-      console.log(queryParams);
+        ...params
+      })
+      console.log(queryParams)
       // 过滤空值参数
       Array.from(queryParams.entries()).forEach(([key, value]) => {
-        if (value === "" || value === null || value === undefined) {
-          queryParams.delete(key);
+        if (value === '' || value === null || value === undefined) {
+          queryParams.delete(key)
         }
-      });
+      })
 
       getauth(`${_this.pathname}?${queryParams}`)
         .then((res) => {
@@ -310,170 +310,170 @@ export default {
             ...item,
             expand: false,
             batch_items: [],
-            loading: false,
-          }));
-          _this.total = res.count;
-          _this.max = Math.ceil(res.count / _this.pagination.rowsPerPage) || 0;
-          _this.pathname_previous = res.previous;
-          _this.pathname_next = res.next;
+            loading: false
+          }))
+          _this.total = res.count
+          _this.max = Math.ceil(res.count / _this.pagination.rowsPerPage) || 0
+          _this.pathname_previous = res.previous
+          _this.pathname_next = res.next
         })
         .catch((err) => {
           _this.$q.notify({
             message: err.detail,
-            icon: "close",
-            color: "negative",
-          });
+            icon: 'close',
+            color: 'negative'
+          })
         })
         .finally(() => {
-          _this.loading = false;
-        });
+          _this.loading = false
+        })
     },
-    changePageEnter() {
+    changePageEnter () {
       if (Number(this.paginationIpt) < 1) {
-        this.current = 1;
-        this.paginationIpt = 1;
+        this.current = 1
+        this.paginationIpt = 1
       } else if (Number(this.paginationIpt) > this.max) {
-        this.current = this.max;
-        this.paginationIpt = this.max;
+        this.current = this.max
+        this.paginationIpt = this.max
       } else {
-        this.current = Number(this.paginationIpt);
+        this.current = Number(this.paginationIpt)
       }
-      this.getSearchList(this.current);
+      this.getSearchList(this.current)
     },
 
     // 带搜索条件加载
-    getSearchList(page = 1) {
-      this.current = page;
-      this.paginationIpt = page;
+    getSearchList (page = 1) {
+      this.current = page
+      this.paginationIpt = page
       this.getList({
         goods_desc__icontains: this.filter,
-        create_time__range: this.date_range,
-      });
+        create_time__range: this.date_range
+      })
     },
 
-    getListPrevious() {
-      var _this = this;
-      if (LocalStorage.has("auth")) {
+    getListPrevious () {
+      var _this = this
+      if (LocalStorage.has('auth')) {
         getauth(_this.pathname_previous, {})
           .then((res) => {
-            _this.table_list = res.results;
-            _this.pathname_previous = res.previous;
-            _this.pathname_next = res.next;
+            _this.table_list = res.results
+            _this.pathname_previous = res.previous
+            _this.pathname_next = res.next
           })
           .catch((err) => {
             _this.$q.notify({
               message: err.detail,
-              icon: "close",
-              color: "negative",
-            });
-          });
+              icon: 'close',
+              color: 'negative'
+            })
+          })
       } else {
       }
     },
-    getListNext() {
-      var _this = this;
-      if (LocalStorage.has("auth")) {
+    getListNext () {
+      var _this = this
+      if (LocalStorage.has('auth')) {
         getauth(_this.pathname_next, {})
           .then((res) => {
-            _this.table_list = res.results;
+            _this.table_list = res.results
 
-            _this.pathname_previous = res.previous;
-            _this.pathname_next = res.next;
+            _this.pathname_previous = res.previous
+            _this.pathname_next = res.next
           })
           .catch((err) => {
             _this.$q.notify({
               message: err.detail,
-              icon: "close",
-              color: "negative",
-            });
-          });
+              icon: 'close',
+              color: 'negative'
+            })
+          })
       }
     },
-    reFresh() {
-      var _this = this;
-      _this.getSearchList();
+    reFresh () {
+      var _this = this
+      _this.getSearchList()
     },
 
-    updateProxy() {
-      var _this = this;
-      _this.proxyDate = _this.date;
-    },
+    updateProxy () {
+      var _this = this
+      _this.proxyDate = _this.date
+    }
   },
-  created() {
-    var _this = this;
-    if (LocalStorage.has("openid")) {
-      _this.openid = LocalStorage.getItem("openid");
+  created () {
+    var _this = this
+    if (LocalStorage.has('openid')) {
+      _this.openid = LocalStorage.getItem('openid')
     } else {
-      _this.openid = "";
-      LocalStorage.set("openid", "");
+      _this.openid = ''
+      LocalStorage.set('openid', '')
     }
-    if (LocalStorage.has("login_name")) {
-      _this.login_name = LocalStorage.getItem("login_name");
+    if (LocalStorage.has('login_name')) {
+      _this.login_name = LocalStorage.getItem('login_name')
     } else {
-      _this.login_name = "";
-      LocalStorage.set("login_name", "");
+      _this.login_name = ''
+      LocalStorage.set('login_name', '')
     }
-    if (LocalStorage.has("auth")) {
-      const timeStamp = Date.now();
-      const formattedString = date.formatDate(timeStamp, "YYYY/MM/DD");
-      _this.date = formattedString;
-      console.log(_this.date);
-      _this.authin = "1";
-      _this.getList();
+    if (LocalStorage.has('auth')) {
+      const timeStamp = Date.now()
+      const formattedString = date.formatDate(timeStamp, 'YYYY/MM/DD')
+      _this.date = formattedString
+      console.log(_this.date)
+      _this.authin = '1'
+      _this.getList()
     } else {
-      _this.authin = "0";
+      _this.authin = '0'
     }
   },
-  mounted() {
-    var _this = this;
+  mounted () {
+    var _this = this
     if (_this.$q.platform.is.electron) {
-      _this.height = String(_this.$q.screen.height - 290) + "px";
+      _this.height = String(_this.$q.screen.height - 290) + 'px'
     } else {
-      _this.height = _this.$q.screen.height - 290 + "" + "px";
+      _this.height = _this.$q.screen.height - 290 + '' + 'px'
     }
     // _this.timer = setInterval(() => {
     //   _this.getlog()
     // }, 1000)
   },
-  updated() {},
-  destroyed() {},
+  updated () {},
+  destroyed () {},
   // 在 watch 或方法中添加调试代码
   watch: {
-    createDate1(val) {
+    createDate1 (val) {
       if (val) {
         if (val.to) {
-          this.createDate2 = `${val.from} - ${val.to}`;
-          this.date_range = `${val.from},${val.to} `;
+          this.createDate2 = `${val.from} - ${val.to}`
+          this.date_range = `${val.from},${val.to} `
 
           // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__range=' + this.date_range
         } else {
-          this.createDate2 = `${val}`;
-          this.dateArray = val.split("/");
+          this.createDate2 = `${val}`
+          this.dateArray = val.split('/')
           this.searchUrl =
             this.pathname +
-            "?" +
-            "document_date__year=" +
+            '?' +
+            'document_date__year=' +
             this.dateArray[0] +
-            "&" +
-            "document_date__month=" +
+            '&' +
+            'document_date__month=' +
             this.dateArray[1] +
-            "&" +
-            "document_date__day=" +
-            this.dateArray[2];
+            '&' +
+            'document_date__day=' +
+            this.dateArray[2]
           // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__year=' + this.dateArray[0] + '&' + 'document_date__month=' + this.dateArray[1] + '&' + 'document_date__day=' + this.dateArray[2]
         }
-        this.date_range = this.date_range.replace(/\//g, "-");
+        this.date_range = this.date_range.replace(/\//g, '-')
 
-        this.getSearchList();
-        this.$refs.qDateProxy.hide();
+        this.getSearchList()
+        this.$refs.qDateProxy.hide()
       } else {
-        this.createDate2 = "";
-        this.date_range = "";
-        this.getSearchList();
+        this.createDate2 = ''
+        this.date_range = ''
+        this.getSearchList()
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style scoped>
 /* 添加在 <style> 中 */

+ 7 - 0
templates/src/pages/stock/management.vue

@@ -183,11 +183,17 @@
                         >
                           {{ "批次号" }}: {{ batch.batchId }}
                         </div>
+                        <div
+                          v-if="batch.time !== 'no_check_time' && batch.time"
+                        >
+                          {{ "库位数目" }}: {{ batch.qty }}
+                        </div>
                         <div
                           v-if="batch.time !== 'no_check_time' && batch.time"
                         >
                           {{ "时间" }}: {{ formatDateTime(batch.time) }}
                         </div>
+                        
                       </div>
                     </div>
                     <div v-else class="batch-no-goods">
@@ -356,6 +362,7 @@ export default {
             status: item[0],
             time: item[1],
             batchId: item[2],
+            qty: item[3],
           };
         }
       });