Forráskód Böngészése

250209-2代码。

baoyubo 4 hónapja
szülő
commit
ff3c48a061

+ 1 - 1
routers/api/resourceProvison/MaterialReserveManagement/warehouse_outbound.py

@@ -58,7 +58,7 @@ async def create_pattern(
         new_outbound.outbound_number= f'{time.strftime("%Y%m%d", time.localtime())}0{str(new_outbound.id).zfill(7)}'
         filePath = f'/data/upload/mergefile/uploads/{body["filename"]}'
         movementData = pd.read_excel(filePath).to_dict(orient='records')
-        status_1 = create_movement(db, movementData, new_outbound.outbound_number, 'I', user_id)
+        status_1 = create_movement(db, movementData, new_outbound.outbound_number, 'O', user_id)
         if status_1 != "成功":
             new_outbound.del_flag = '2'
             db.commit()

+ 8 - 6
utils/resource_provision_util.py

@@ -248,13 +248,15 @@ def create_movement(db,movement:list,io_number,io_flag,user_id):
 
                     return '剩余库存小于出库量'
                 remaining_stock =  material_info.remaining_stock-changed_stock
-
+        else:
+            if io_flag == 'O':
+                return '物资不存在,无法出库'
         new_movement = ResourceProvisionWarehouseMovement(
-            material_id=material_id,#Column(String(255), nullable=False, comment='物资id')
-            io_number = io_number,#Column(String(255), nullable=False, comment='出入库单号')
-            io_flag = io_flag,#Column(String(10), nullable=False, comment='出入库标识')
-            changed_stock = changed_stock,#Column(Integer, nullable=False, comment='变动库存')
-            remaining_stock = remaining_stock,#Column(Integer, nullable=False, comment='剩余库存')
+            material_id=material_id,  # Column(String(255), nullable=False, comment='物资id')
+            io_number=io_number,  # Column(String(255), nullable=False, comment='出入库单号')
+            io_flag=io_flag,  # Column(String(10), nullable=False, comment='出入库标识')
+            changed_stock=changed_stock,  # Column(Integer, nullable=False, comment='变动库存')
+            remaining_stock=remaining_stock,  # Column(Integer, nullable=False, comment='剩余库存')
             create_by=user_id
         )
         db.add(new_movement)