Browse Source

241217-1代码。

baoyubo 5 months ago
parent
commit
069732b563

+ 81 - 1
models/resource_provision_base.py

@@ -584,4 +584,84 @@ class ResourceProvisionDispatchReview(Base):
     create_by = Column(BigInteger, default=None, comment='创建者')
     update_by = Column(BigInteger, default=None, comment='更新者')
     del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
-    remark = Column(Text, nullable=True, comment='备注')
+    remark = Column(Text, nullable=True, comment='备注')
+
+
+class ResourceProvisionOutboundBasic(Base):
+    __tablename__ = 'resource_provision_outbound_basic'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
+    outbound_number = Column(String(255), nullable=False, comment='出库单号')
+    warehouse_id = Column(String(255), nullable=False, comment='仓库id')
+    total_volume = Column(Numeric(20, 2), nullable=False, comment='出库单商品总体积(立方厘米)')
+    total_weight = Column(Numeric(20, 2), nullable=False, comment='出库单商品总重量(kg)')
+    total_shipping_volume = Column(Numeric(20, 2), nullable=False, comment='出库单发货总体积(立方厘米)')
+    total_shipping_weight = Column(Numeric(20, 2), nullable=False, comment='出库单发货总重量(kg)')
+    total_quantity = Column(Integer, nullable=False, comment='出库单商品总数量')
+    shipping_time = Column(DateTime, comment='出库单发货时间')
+    disaster_type = Column(String(255), comment='灾种名称')
+    dispatching_agency = Column(String(255), comment='调运机构名称')
+    shipper_name = Column(String(255), comment='发货人姓名')
+    shipper_mobile = Column(String(20), comment='发货人手机')
+    shipper_address = Column(String(255), comment='发货人地址')
+    shipper_remark = Column(Text, comment='发货方备注')
+    receiver_name = Column(String(255), comment='收货人姓名')
+    receiver_mobile = Column(String(20), comment='收货人手机')
+    receiver_address = Column(String(255), comment='收货人地址')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
+    remark = Column(Text, comment='备注')
+
+
+class ResourceProvisionWarehouseMovement(Base):
+    __tablename__ = 'resource_provision_warehouse_movement'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
+    material_id = Column(String(255), nullable=False, comment='物资id')
+    io_number = Column(String(255), nullable=False, comment='出入库单号')
+    io_flag = Column(String(10), nullable=False, comment='出入库标识')
+    changed_stock = Column(Integer, nullable=False, comment='变动库存')
+    remaining_stock = Column(Integer, nullable=False, comment='剩余库存')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
+    remark = Column(Text, comment='备注')
+
+
+class ResourceProvisionInboundBasic(Base):
+    __tablename__ = 'resource_provision_inbound_basic'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
+    warehouse_id = Column(String(255), nullable=False, comment='仓库id')
+    purchase_order_number = Column(String(255), nullable=False, comment='采购单号')
+    is_donation = Column(String(10), nullable=False, comment='是否捐赠(是、否)')
+    transport_order_number = Column(String(255), nullable=False, comment='运输单号')
+    donator_phone = Column(String(20), comment='捐赠人联系电话')
+    donator_name = Column(String(255), comment='捐赠人姓名')
+    reviewer = Column(String(255), comment='审核人')
+    enterprise_name = Column(String(255), comment='企业名称')
+    enterprise_code = Column(String(255), comment='企业编号')
+    grading_info = Column(String(255), comment='分级信息')
+    type = Column(Integer, nullable=False, comment='类型(1 调拨入库、2 归还入库、3 回收入库)')
+    supplier_name = Column(String(255), comment='供应商名称')
+    creation_time = Column(DateTime, comment='创建时间')
+    remark = Column(Text, comment='备注')
+    supplier_code = Column(String(255), comment='供应商编号')
+    completion_time = Column(DateTime, comment='完成时间')
+    planned_completion_time = Column(DateTime, comment='计划完成时间')
+    room_id = Column(String(255), comment='库房id')
+    inbound_order_number = Column(String(255), comment='入库单号')
+    new_time = Column(DateTime, comment='新增时间')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')

+ 30 - 18
routers/api/resourceProvison/MaterialReserveManagement/dispatch.py

@@ -32,6 +32,7 @@ async def create_pattern(
 ):
     try:
         dept_info = user_id_get_user_info(db,user_id)
+
         new_dispatch = ResourceProvisionDispatch(
             id = new_guid(),
             dispatch_purpose=body['dispatch_purpose'],
@@ -42,22 +43,28 @@ async def create_pattern(
         )
         db.add(new_dispatch)
         for info in body['detail']:
-            material_type_info = type_id_get_material_type_info(db, info['material_type_id'])
-            if material_type_info:
-                material_category_name = material_type_info.material_category_name
-            else:
-                material_category_name = None
             material_into = material_id_get_material_info(db, info['material_code'])
             if material_into:
                 material_name = material_into.material_name
+                material_type_id = material_into.material_type
+                warehouse_id=material_into.warehouse_id
+                material_type_info = type_id_get_material_type_info(db, material_into.material_type)
+                if material_type_info:
+                    material_category_name = material_type_info.material_category_name
+                else:
+                    material_category_name = None
             else:
+                material_type_id=None
+                warehouse_id = None
                 material_name = None
+                material_category_name = None
+
             new_detail = ResourceProvisionDispatchDetail(
                 id=new_guid(),
                 serial_number=info['serial_number'],
                 dispatch_id = new_dispatch.id,
-                warehouse_id = info['warehouse_id'],
-                material_type_id = info['material_type_id'],
+                warehouse_id = warehouse_id,
+                material_type_id = material_type_id,
                 material_type = material_category_name,
                 material_code = info['material_code'],
                 material_name = material_name,
@@ -92,23 +99,28 @@ async def update_dispatch(
 
         detail_list = []
         for info in body['detail']:
-            material_type_info = type_id_get_material_type_info(db, info['material_type_id'])
-            if material_type_info:
-                material_category_name = material_type_info.material_category_name
-            else:
-                material_category_name = None
             material_into = material_id_get_material_info(db, info['material_code'])
             if material_into:
                 material_name = material_into.material_name
+                material_type_id = material_into.material_type
+                warehouse_id = material_into.warehouse_id
+                material_type_info = type_id_get_material_type_info(db, material_into.material_type)
+                if material_type_info:
+                    material_category_name = material_type_info.material_category_name
+                else:
+                    material_category_name = None
             else:
+                material_type_id = None
+                warehouse_id = None
                 material_name = None
+                material_category_name = None
             if info['id']=='':
                 new_detail = ResourceProvisionDispatchDetail(
                     id=new_guid(),
                     serial_number=info['serial_number'],
                     dispatch_id=update_dispatch.id,
-                    warehouse_id=info['warehouse_id'],
-                    material_type_id=info['material_type_id'],
+                    warehouse_id=warehouse_id,
+                    material_type_id=material_type_id,
                     material_type=material_category_name,
                     material_code=info['material_code'],
                     material_name=material_name,
@@ -125,8 +137,8 @@ async def update_dispatch(
                         id=new_guid(),
                         serial_number=info['serial_number'],
                         dispatch_id=update_dispatch.id,
-                        warehouse_id=info['warehouse_id'],
-                        material_type_id=info['material_type_id'],
+                        warehouse_id=warehouse_id,
+                        material_type_id=material_type_id,
                         material_type=material_category_name,
                         material_code=info['material_code'],
                         material_name=material_name,
@@ -138,8 +150,8 @@ async def update_dispatch(
                     detail_list.append(new_detail.id)
                 else:
                     detail.serial_number = info['serial_number']
-                    detail.warehouse_id = info['warehouse_id']
-                    detail.material_type_id = info['material_type_id']
+                    detail.warehouse_id = warehouse_id
+                    detail.material_type_id = material_type_id
                     detail.material_type = material_category_name
                     detail.material_code = info['material_code']
                     detail.material_name = material_name

+ 10 - 8
routers/api/resourceProvison/MaterialReserveManagement/procurement.py

@@ -42,12 +42,13 @@ async def create_pattern(
         )
         db.add(new_declaration)
         for info in body['detail']:
+            material_info = material_id_get_material_info(db,info['material_code'])
             new_detail = ResourceProvisionProcurementDeclarationDetail(
                 id=new_guid(),
                 serial_number=info['serial_number'],
                 declaration_id = new_declaration.id,
-                warehouse_id = info['warehouse_id'],
-                material_type = info['material_type'],
+                warehouse_id = material_info.warehouse_id,
+                material_type = material_info.material_type,
                 material_code = info['material_code'],
                 material_quantity = info['material_quantity'],
                 material_unit_price = info['material_unit_price'],
@@ -81,13 +82,14 @@ async def update_pattern(
 
         detail_list = []
         for info in body['detail']:
+            material_info = material_id_get_material_info(db, info['material_code'])
             if info['id']=='':
                 new_detail = ResourceProvisionProcurementDeclarationDetail(
                     id=new_guid(),
                     serial_number=info['serial_number'],
                     declaration_id=update_declaration.id,
-                    warehouse_id = info['warehouse_id'],
-                    material_type=info['material_type'],
+                    warehouse_id = material_info.warehouse_id,
+                    material_type=material_info.material_type,
                     material_code=info['material_code'],
                     material_quantity=info['material_quantity'],
                     material_unit_price=info['material_unit_price'],
@@ -103,8 +105,8 @@ async def update_pattern(
                         id=new_guid(),
                         serial_number=info['serial_number'],
                         declaration_id=update_declaration.id,
-                        warehouse_id = info['warehouse_id'],
-                        material_type=info['material_type'],
+                        warehouse_id = material_info.warehouse_id,
+                        material_type=material_info.material_type,
                         material_code=info['material_code'],
                         material_quantity=info['material_quantity'],
                         material_unit_price=info['material_unit_price'],
@@ -115,8 +117,8 @@ async def update_pattern(
                     detail_list.append(new_detail.id)
                 else:
                     detail.serial_number = info['serial_number']
-                    detail.warehouse_id = info['warehouse_id']
-                    detail.material_type = info['material_type']
+                    detail.warehouse_id = material_info.warehouse_id
+                    detail.material_type = material_info.material_type
                     detail.material_code = info['material_code']
                     detail.material_quantity = info['material_quantity']
                     detail.material_unit_price = info['material_unit_price']