select task_id, task_no, scope_type, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, category_id, category_code, category_name, owner_user_id, owner_user_name, task_status, issue_time, finish_time, create_by, create_time, update_by, update_time, remark, del_flag from ams_inventory_task insert into ams_inventory_task ( task_no, scope_type, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, category_id, category_code, category_name, owner_user_id, owner_user_name, task_status, create_by, create_time, remark, del_flag ) values ( #{taskNo}, #{scopeType}, #{warehouseId}, #{warehouseCode}, #{warehouseName}, #{locationId}, #{locationCode}, #{locationName}, #{categoryId}, #{categoryCode}, #{categoryName}, #{ownerUserId}, #{ownerUserName}, #{taskStatus}, #{createBy}, #{createTime}, #{remark}, #{delFlag} ) update ams_inventory_task set scope_type = #{scopeType}, warehouse_id = #{warehouseId}, warehouse_code = #{warehouseCode}, warehouse_name = #{warehouseName}, location_id = #{locationId}, location_code = #{locationCode}, location_name = #{locationName}, category_id = #{categoryId}, category_code = #{categoryCode}, category_name = #{categoryName}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark} where task_id = #{taskId} and del_flag = '0' and task_status = 'DRAFT' update ams_inventory_task task_status = #{taskStatus}, issue_time = #{issueTime}, finish_time = #{finishTime}, update_by = #{updateBy}, update_time = #{updateTime}, where task_id = #{taskId} and del_flag = '0' and task_status = #{params.expectedStatus} and task_status in #{status} and task_status not in #{status} update ams_inventory_task_item set inventory_warehouse_id = #{inventoryWarehouseId}, inventory_warehouse_name = #{inventoryWarehouseName}, inventory_location_id = #{inventoryLocationId}, inventory_location_name = #{inventoryLocationName}, inventory_result = #{inventoryResult}, inventory_user_id = #{inventoryUserId}, inventory_user_name = #{inventoryUserName}, inventory_time = #{inventoryTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark} where item_id = #{itemId} and task_id = #{taskId} and del_flag = '0' insert into ams_inventory_task_surplus ( task_id, task_no, surplus_type, identify_method, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, tag_id, tag_code, epc_code, book_asset_status, book_warehouse_id, book_warehouse_code, book_warehouse_name, book_location_id, book_location_code, book_location_name, inventory_warehouse_id, inventory_warehouse_code, inventory_warehouse_name, inventory_location_id, inventory_location_code, inventory_location_name, inventory_user_id, inventory_user_name, inventory_time, confirm_status, create_by, create_time, remark, del_flag ) values ( #{taskId}, #{taskNo}, #{surplusType}, #{identifyMethod}, #{assetId}, #{assetCode}, #{assetName}, #{categoryId}, #{categoryCode}, #{categoryName}, #{specModel}, #{brand}, #{tagId}, #{tagCode}, #{epcCode}, #{bookAssetStatus}, #{bookWarehouseId}, #{bookWarehouseCode}, #{bookWarehouseName}, #{bookLocationId}, #{bookLocationCode}, #{bookLocationName}, #{inventoryWarehouseId}, #{inventoryWarehouseCode}, #{inventoryWarehouseName}, #{inventoryLocationId}, #{inventoryLocationCode}, #{inventoryLocationName}, #{inventoryUserId}, #{inventoryUserName}, #{inventoryTime}, #{confirmStatus}, #{createBy}, #{createTime}, #{remark}, #{delFlag} ) update ams_inventory_task_surplus set confirm_status = #{confirmStatus}, update_by = #{updateBy}, update_time = now() where task_id = #{taskId} and confirm_status = 'RECORDED' and del_flag = '0' update ams_inventory_task_surplus set del_flag = '1', update_by = #{updateBy}, update_time = now() where surplus_id = #{surplusId} and del_flag = '0' and confirm_status = 'RECORDED' update ams_inventory_task set del_flag = '1' where task_id = #{taskId} and del_flag = '0' and task_status = 'DRAFT' update ams_inventory_task set del_flag = '1' where task_id in #{taskId} and del_flag = '0' and task_status = 'DRAFT' update ams_inventory_task_item set del_flag = '1' where task_id in #{taskId} and del_flag = '0' update ams_inventory_task_item set del_flag = '1' where task_id = #{taskId} and del_flag = '0' update ams_inventory_task_surplus set del_flag = '1' where task_id = #{taskId} and del_flag = '0' insert into ams_inventory_task_item ( task_id, task_no, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, book_warehouse_id, book_warehouse_name, book_location_id, book_location_name, create_by, create_time, remark, del_flag ) values ( #{item.taskId}, #{item.taskNo}, #{item.assetId}, #{item.assetCode}, #{item.assetName}, #{item.categoryId}, #{item.categoryCode}, #{item.categoryName}, #{item.specModel}, #{item.brand}, #{item.bookWarehouseId}, #{item.bookWarehouseName}, #{item.bookLocationId}, #{item.bookLocationName}, #{item.createBy}, #{item.createTime}, #{item.remark}, #{item.delFlag} )